Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optimization pass #13

Open
madsobitsoe opened this issue Dec 16, 2020 · 0 comments
Open

Add optimization pass #13

madsobitsoe opened this issue Dec 16, 2020 · 0 comments
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 .

Comments

@madsobitsoe
Copy link
Owner

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 to Const (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 the Sub expression with a Const expression.

@madsobitsoe madsobitsoe added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers No assembly This issue does not require touching the code generator. It is an "easy" issue . labels Dec 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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 .
Projects
None yet
Development

No branches or pull requests

1 participant