Stack Handling in Loops #42
charlesbetros
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
@charlesbetros I haven't had a lot of time to work on this project. Generally, I code all day for work, and lately don't feel like coding any extra for fun... That might change at some point, though! My memory of the int x = 0;
x += 1;
x += 1;
x += 1;
x += 1; I wonder if that even works with the current code? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
IL ops like Add don't currently work inside of a loop where the number of loops is not constant or when both operands are not constant.
For example, the current implementation
Stack.Push(Stack.Pop() + Stack.Pop())
would push once during transpiling.
Would it be better to store only the operand types in our Stack instead of actual values? This way we know some size types will be popped and a new type pushed, but we wouldn't try to keep track of values.
In the lols sample we have something like:
Since the IL ops are processed once we pop 0, pop 1 and push 1. Then jump and repeat.
Beta Was this translation helpful? Give feedback.
All reactions