Search code examples
antlr3antlrworks

Is it possible too see Syntax diagram of CSharp3 entire grammar in AntlrWorks?


it is possible to see diargam for one rule when it is seleted in editor, but i want to see diagram for entire grammar. like on this picture, with some analysis on it. i am using AntlrWorks 1.5 on windows 7.

Thank You!


Solution

  • You interpreted the diagram wrongly, as it does not show entire grammar, but how a rule contains ambiguity.

    Thus, if in your grammar you define such a rule, you can see the diagram as you wish, but it won't appear in a grammar that has no ambiguity.

    Steps to reproduce such a diagram can be,

    1. Download https://raw.github.com/lextm/sharpsnmplib/master/SharpSnmpLib/Mib/Smi_no_action.g to your disk as Smi_no_action.g.
    2. Open it in ANTLRWorks.
    3. Click Generate | Generate Code menu item. (Warnings should appear in Console tab to show ambiguous items.)
    4. Place the cursor on line 569 of the grammar file. Then in Syntax Diagram tab you will see a similar diagram indicating how the ambiguity is formed.