-
-
Notifications
You must be signed in to change notification settings - Fork 402
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
Streaming Parsing (from Lexer to Parser) #288
Comments
About the cursor, it might need to return a |
Something we might need would be to add an Doing this in multiple threads could be done by lexing in one thread, parsing in another and executing in another. Doing concurrent parser might prove to be more difficult, though. |
The lexer can close the channel once it's finished, this will signal to the parser there is nothing more to come down the pipe. |
It might be due to the way parsing and lexing are related (goal symbols) this may not be possible. Related: |
I think that what can be done is for the parser to request lexing of new tokens to the lexer via calls to |
I may close this seeing as we can't do it that way dur to the lexer needing context |
Actually, I think this is now more important than ever! Instead of "streaming" we could do "lazy" lexing, and making the parser iterate over it, while changing context as needed. @maciejhirsz proposed to use Logos for this, and I think it makes sense. Not sure if there was any progress in that front. |
I'm on holidays since yesterday, so I should have time to dig into Boa at last :) Streaming (iterating) the tokens during parsing if anything makes things easier, since the Parser can supply the Lexer with context if need be. The main culprit in JS is the regex literal, and the rule here is fairly simple: any expression that begins with division token |
Let us know if we can be of any help :) |
The way Boa works right now is that the Lexer will run till completion. Then once an array of tokens is filled this is sent over the parser.
However the parser doesn't need to wait idle whilst the Lexer is running, the parser can begin working through the tokens as they come through..
Completely inspired from how Go parses its templates, Rob talks about it in more detail here:
https://youtu.be/HxaD_trXwRE?t=960
Parser Cursor
Does the cursor need to change?
Can it work in its current state? @Razican is working on the updated cursor right now.
jasonwilliams#287
Can Rust's Async/Await help here?
Maybe, i'm not sure.
Diagram
@Razican @HalidOdat thoughts?
The text was updated successfully, but these errors were encountered: