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

Refactor AST and interpreter, temporarily disable records #48

Merged
merged 7 commits into from
Dec 27, 2024
Merged

Conversation

maplant
Copy link
Owner

@maplant maplant commented Dec 25, 2024

The current structure of using an evaluator trait has reached its limits, not that it was every really that great. Instead of having an evaluator trait, this PR introduces an AstNode enumeration, including Definition and Expression enumerations.

The AstNode can be created from a syntax object via AstNode::parse, which performs all of the necessary expansions at the correct time. After an AstNode is created, it can be evaluated directly by running its eval procedure.

The core reason for this restructure is that I would like to introduce compilation to the pipeline. In theory, that should look like the following:

Syntax -> AstNode (bundled into compilation units) -> CPS -> LLVM IR -> compiled functions

This should reduce a lot of code, and ultimately be quite a bit faster. Additionally, this new structure should make adding continuations to the expansion process more viable. Additionally additionally, this new structure is waaaaaay easier to debug.

This PR is likely to introduce some bugs, it changes a lot of code. Oh well, I'll add more tests hopefully soon.

@maplant maplant changed the title DRAFT: Flesh out new structure for interpreter (and eventual compilation) Flesh out new structure for interpreter (and eventual compilation) Dec 27, 2024
@maplant maplant changed the title Flesh out new structure for interpreter (and eventual compilation) Better AST Dec 27, 2024
@maplant maplant changed the title Better AST Refactor AST and interpreter, temporarily disable records Dec 27, 2024
@maplant maplant merged commit f399324 into main Dec 27, 2024
1 check passed
@maplant maplant deleted the cleanup branch December 27, 2024 01:12
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 this pull request may close these issues.

1 participant