How to use different parsers with one input text to make an AST? #1730
-
Hi Chevrotain community I am trying to make my own simple version of React using Chevrotain. So far I have a parser that can recognize some grammar rules for function declaration, import statement and so on. Now my question is: I'm really stuck here. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hello @nathantetro
There is normally some root rule that iterates on these sub-rules of the different parts. e.g:
E.g in Java a program may be:
This is actually defined in the Java Grammar and would be your root rule if you were implementing a Parser for Java... |
Beta Was this translation helpful? Give feedback.
-
Hi @bd82 Working with a root rule worked for me. Thanks for helping out! :) |
Beta Was this translation helpful? Give feedback.
Hello @nathantetro
There is normally some root rule that iterates on these sub-rules of the different parts. e.g:
chevrotain/examples/grammars/tinyc/tinyc.js
Lines 57 to 61 in efbc5da
E.g in Java a program may be:
This is actually defined in the Java Grammar and would be your root rule if you were implementing a Parser for Java...