You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Moved Lookahead Function computation to parser initialization.
- This Increases the initialization time, but gained 5-15% runtime performance boost (Parser only benchmark, no Lexer involved).
Support maxLookahead config per DSL method rather than just a global setting.
classLowLookaheadParserextendsCstParser{constructor(){super([],{// Globally **only one** token lookahead.maxLookahead: 1})$.RULE("value",()=>{$.OR({// We need **two** tokens lookahead to distinguish between these two alternativesMAX_LOOKAHEAD: 2,DEF: [{ALT: ()=>{$.CONSUME(A)$.CONSUME(B)}},{ALT: ()=>{$.CONSUME(A)$.CONSUME(C)}}]})})this.performSelfAnalysis()}}
Original Issue
The LA functions are evaluated lazily when needed.
This is useful when parsing small inputs that may not need all of the LA functions.
However if by creating these all LA functions at startup it may be possible to:
Improve runtime speed by avoiding the check if the LA function has been created.
Improve analysis speed by memoization of previous results.
Enable inspecting the actually needed maxLookahead versus the one defined by the user.
Enable providing these lookahead functions "pre-prepared" e.g via some kind of code generation. this could both:
Reduce init/first run time.
Increase runtime performance by providing more optimized lookahead functions
The text was updated successfully, but these errors were encountered:
Changes
- This Increases the initialization time, but gained 5-15% runtime performance boost (Parser only benchmark, no Lexer involved).
Original Issue
The LA functions are evaluated lazily when needed.
This is useful when parsing small inputs that may not need all of the LA functions.
However if by creating these all LA functions at startup it may be possible to:
The text was updated successfully, but these errors were encountered: