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

Optimize output #2

Open
JohnathonNow opened this issue Oct 2, 2018 · 0 comments
Open

Optimize output #2

JohnathonNow opened this issue Oct 2, 2018 · 0 comments

Comments

@JohnathonNow
Copy link
Owner

Right now the output instructions are very naive, with no optimizations at all. For fun it might be worth trying out some optimization techniques. For instance, doing a push and a subtract-pop immediately results in the register being set to 0.

It seems easy enough to replace instructions of the form

PUSH_X
SUBTRACT_X

where X is either LEFT or RIGHT, with something like

RESET_REGISTER

where RESET_REGISTER sets the register value to 0.

I am sure other optimizations could be made as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant