-
Is there a solution to the associativity problem in chevrotain/ecma5? If so, how is it done? When I use chevrotain/ecma5 to execute var a = 1+2*3+4, the result is
When I use acorn in https://astexplorer.net/ I get the result I also tried chevrotain/calculator and got the same result. Chevrotain's processing method is to group by token type, instead of classifying left and right nodes like acorn. So, I don't understand how chevrotain solves the associativity problem. Can you tell me where I can find documentation on this? Or can you point me to it? I executed the chevrotain/calculator code and got the same result. It does not differentiate between left and right nodes, but uses grouping. How does this solve the TB problem? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Chevrotain produces a Concrete Syntax Tree which is implicitly defined by the grammar. In regards to expressions parsing:
BTW for the simplest of scenarios, 2 operads, one operator.
|
Beta Was this translation helpful? Give feedback.
Chevrotain produces a Concrete Syntax Tree which is implicitly defined by the grammar.
So of course the structure would be different from a different parser (e.g Acorn).
And could be different between different implementations of the same grammar in Chevrotain.
In regards to expressions parsing: