Skip to content
Discussion options

You must be logged in to vote

Hello @hydra1983

Modeling the binary operator precedence as part of the grammar tends to result in very deeply nested parse trees
and a large performance overhead.

Perhaps Antlr has some optimizations around this pattern.
If you are building a productive grammar with Chevrotain which uses binary operators
I would recommend to apply the Swift programming language approach of parsing the operators as a flat list
and computing the precedence at a post-parsing phase.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@hydra1983
Comment options

@robocoder
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by bd82
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #2082 on December 27, 2024 22:40.