I have created simple grammar file in IntelliJ but failing to see any effect of Antlr plugin. When I open file in ANTLR preview, it says
start rule: <select from navigator or grammar>
What is start rule? How to select it from navigator? How to select it from grammar?
So I haven't found a way to mark permanently one rule as a start rule, however in the right-click context menu for the grammar, there are two options that relate to ANTLR, one of them is 'test rule xyz', that did the job:
You need to right-click the specific rule name in the grammar (.g4 file), to have the option of "Test rule " active in the popup context menu.
You should paste your "program" (e.g., a Java program/class) in the "Preview" window, not your grammer/rules (e.g., grammer of Java language). Then select the target rule xxx, right click and select "Test Rule xxx". This means you can test any single rule, not only the root rule:
Test root rule "prog"
Test rule "stat"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With