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
2a23ec52
Commit
2a23ec52
authored
3 months ago
by
Daniel Bauer
Committed by
Frederik Hennig
3 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Extend symbol canonicalization
parent
3b9860fb
Branches
Branches containing commit
No related tags found
1 merge request
!451
Extend symbol canonicalization
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/pystencils/backend/transformations/canonicalize_symbols.py
+20
-1
20 additions, 1 deletion
...ystencils/backend/transformations/canonicalize_symbols.py
with
20 additions
and
1 deletion
src/pystencils/backend/transformations/canonicalize_symbols.py
+
20
−
1
View file @
2a23ec52
...
@@ -3,7 +3,15 @@ from ..memory import PsSymbol
...
@@ -3,7 +3,15 @@ from ..memory import PsSymbol
from
..exceptions
import
PsInternalCompilerError
from
..exceptions
import
PsInternalCompilerError
from
..ast
import
PsAstNode
from
..ast
import
PsAstNode
from
..ast.structural
import
PsDeclaration
,
PsAssignment
,
PsLoop
,
PsConditional
,
PsBlock
from
..ast.structural
import
(
PsDeclaration
,
PsAssignment
,
PsLoop
,
PsConditional
,
PsBlock
,
PsStatement
,
PsEmptyLeafMixIn
,
)
from
..ast.expressions
import
PsSymbolExpr
,
PsExpression
from
..ast.expressions
import
PsSymbolExpr
,
PsExpression
from
...types
import
constify
from
...types
import
constify
...
@@ -117,3 +125,14 @@ class CanonicalizeSymbols:
...
@@ -117,3 +125,14 @@ class CanonicalizeSymbols:
case
PsBlock
(
statements
):
case
PsBlock
(
statements
):
for
stmt
in
statements
[::
-
1
]:
for
stmt
in
statements
[::
-
1
]:
self
.
visit
(
stmt
,
cc
)
self
.
visit
(
stmt
,
cc
)
case
PsStatement
(
expr
):
self
.
visit
(
expr
,
cc
)
case
PsEmptyLeafMixIn
():
...
case
unknown
:
raise
PsInternalCompilerError
(
f
"
Can
'
t canonicalize symbols in
{
unknown
}
(
{
repr
(
unknown
)
}
).
"
)
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