I have been looking at the grammars located at:
and I have been using Antlrworks 2 to view them, however I am finding it difficult to locate the start rule for the entire grammar.
I think the definition of a start rule is a node which has no other pointers to it, does anyone have a working solution to find the start rule for these grammars?
To find the root/start rule I have implemented a ANTLR tree listener which creates an adjacency list of all the rules in an ANTLR grammar and check to see if no other grammar rule references it. This would give a hint as to what the start rule might be.
To run this you will need the antlr grammar taken from Antlr 4 grammar
Here is the listener implementation:
(RootFinder.java)
and here is the Main program that runs it
(Main.java)