Add optimization pass #13
Labels
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
No assembly
This issue does not require touching the code generator. It is an "easy" issue .
This is very much premature optimization, but here goes.
If one of the goals of this project is to produce teensy binaries, the parsed AST should most definitely be reduced to the smallest equivalent form we can achive.
Add (Const a, Const b)
is equivalent toConst (a+b)
.As long as the operation is associative, it should be possible to rewrite the AST.
Sub (e1, e2)
can not be directly optimized, but the sub-expression (possibly) can. Recursively optimizing could potentially replace theSub
expression with aConst
expression.The text was updated successfully, but these errors were encountered: