Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pystencils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pycodegen
pystencils
Commits
89789777
Commit
89789777
authored
11 months ago
by
Frederik Hennig
Browse files
Options
Downloads
Patches
Plain Diff
hold back expr evaluation for now
parent
a333aa55
No related branches found
No related tags found
1 merge request
!393
Ternary Expressions, Improved Integer Divisions, and Iteration Space Fix
Pipeline
#67191
passed
11 months ago
Stage: Code Quality
Stage: Unit Tests
Stage: legacy_test
Stage: docs
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/pystencils/backend/ast/expressions.py
+0
-33
0 additions, 33 deletions
src/pystencils/backend/ast/expressions.py
with
0 additions
and
33 deletions
src/pystencils/backend/ast/expressions.py
+
0
−
33
View file @
89789777
...
...
@@ -757,36 +757,3 @@ class PsArrayInitList(PsExpression):
def
__repr__
(
self
)
->
str
:
return
f
"
PsArrayInitList(
{
repr
(
self
.
_items
)
}
)
"
def
evaluate_expression
(
expr
:
PsExpression
,
valuation
:
dict
[
str
|
PsSymbol
,
Any
]
)
->
Any
:
"""
Evaluate a pystencils backend expression tree with values assigned to symbols according to the given valuation.
Only a subset of expression nodes can be processed by this evaluator.
"""
def
visit
(
node
):
match
node
:
case
PsSymbolExpr
(
symb
):
if
value
:
=
valuation
.
get
(
symb
,
None
)
is
not
None
:
return
value
else
:
return
valuation
[
symb
.
name
]
case
PsConstantExpr
(
c
):
return
c
.
value
case
PsUnOp
(
op1
)
if
node
.
python_operator
is
not
None
:
return
node
.
python_operator
(
visit
(
op1
))
case
PsBinOp
(
op1
,
op2
)
if
node
.
python_operator
is
not
None
:
return
node
.
python_operator
(
visit
(
op1
),
visit
(
op2
))
case
other
:
raise
NotImplementedError
(
f
"
Unable to evaluate
{
other
}
: No implementation available.
"
)
return
visit
(
expr
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment