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

Clean up function definition and calling #40

Merged
merged 9 commits into from
Feb 8, 2024
Merged

Conversation

jonathanhogg
Copy link
Owner

See #38

@jonathanhogg jonathanhogg added 🚀 enhancement New feature or request 💬 language Anything to do with the parser/evaluator/VM labels Feb 6, 2024
@jonathanhogg jonathanhogg self-assigned this Feb 6, 2024
@jonathanhogg jonathanhogg linked an issue Feb 6, 2024 that may be closed by this pull request
@jonathanhogg jonathanhogg added this to the Version 1.0.0 milestone Feb 6, 2024
Simplify `call_helper`; throw `CallFast` instruction.
I need a pre-commit hook to run the tests and linter...
This is a little expensive at the moment as it copies a local names stack on each function call.
…gh execution

This now *requires* that the simplifier be run for function definition to work. Names external to a function are now captured at definition time, which means we need to know what those names are, and the simplifier contains the logic to do that.
Instead of each program having its own sub-program, function bodies are compiled into the program where they are defined and the `Function` object maintains a link to this program and the address that the function starts at. Necessitated adding a new `Exit` instruction to jump to the end of the program and return early.
@jonathanhogg jonathanhogg marked this pull request as ready for review February 7, 2024 15:33
…dule

Also, rename `.graph` to `.root` while I'm at it.
@jonathanhogg jonathanhogg merged commit 3133580 into main Feb 8, 2024
4 checks passed
@jonathanhogg jonathanhogg deleted the enh_func_cleanup branch February 8, 2024 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 enhancement New feature or request 💬 language Anything to do with the parser/evaluator/VM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Functions and function calling needs a cleanup
1 participant