Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
6 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82e9190
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, since you're having a look at the self-hosted parsing code, here are some ideas I have for the future:
@newStackCall
and eventual ability to statically determine stack upper bound and detect call graph cycles), rewrite the self-hosted parser in a more natural recursive way. The render code is already done this way.ArrayList(*Node)
or make ast nodes tagged unions and useSegmentedList(Node)
. Whichever is faster. With the tagged union strategy, we could set a maximum node size with comptime asserts, and if a node wants to exceed this it would have to have a pointer fieldother_fields
with the other stuff allocated separately.SegmentedList(*Node)
- the current implementation - is kind of pointless because it's an unnecessary double pointer situation. However due to the non-recursive implementation of the parser, SegmentedList is handy because it lets you rely on the lifetime of items being permanent whereas ArrayList item pointer lifetimes expire on everyappend
. I believe that with normal recursive descent this difference would not matter (we use ArrayList in the stage1 recursive descent parser).