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

Implementation: Compile to bytecode #2

Closed
skx opened this issue Sep 17, 2019 · 0 comments · Fixed by #4
Closed

Implementation: Compile to bytecode #2

skx opened this issue Sep 17, 2019 · 0 comments · Fixed by #4
Assignees

Comments

@skx
Copy link
Owner

skx commented Sep 17, 2019

This was a quick hack which explains why the Run method walks the tokens directly from the lexer. However doing this is bad for two reasons:

  • We don't spot syntax-errors until we run the script.
  • We've got a performance hit if the same script is run multiple times.

Solution? Convert from the lexer-tokens to bytecode. This is trivial since we only have three main operations:

  • Call a function, with no arguments.
  • Run a comparison; return a value if it matches (true/false).
  • Return a value (true/false).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant