idyll-lang / idyll

Create explorable explanations and interactive essays.
http://idyll-lang.org/
MIT License
2.01k stars 87 forks source link

parse tokens incrementally; kill a grammar ambiguity #769

Closed mathisonian closed 2 years ago

mathisonian commented 2 years ago

This is an internal change to improve the performance of the compiler, and prepare for some upcoming changes for better IDE support and error messages.

This should not result in any external behavioral change. It changes how the parser is invoked internally. It also changes the grammar to remove a potential ambiguity (but does not change the parsed output).

Some files fail to render (e.g. https://github.com/idyll-lang/idyll/issues/736) due to memory usage.

Files are properly parsed and rendered.

No.

mathisonian commented 2 years ago

/cc @TwoTau. To get this to work I had to change the return value of the lexer rules. In particular, they are now wrapped in another array. This will change further as we add additional metadata to the tokens themselves, but I want to get this incremental change in quickly since it fixes some issue.