0

In the antlr documentation, I see the two following rules but their description sounds exactly the same. What is the difference between these two rules...

a : INT ID -> ID INT ; // reorder nodes
a : ^(ID INT) -> ^(INT ID) ; // flip order of nodes in tree

Also, why not write the second rule like this or would that be the same as the first rule then and so there is no difference between the rules?

a : ^(INT ID) -> ^(ID INT) ;

thanks, Dean

Dean Hiller
  • 19,235
  • 25
  • 129
  • 212

1 Answers1

2
  • ^(INT ID) means INT is the root, and ID the child.
  • INT ID means both INT and ID are child nodes.
Bart Kiers
  • 166,582
  • 36
  • 299
  • 288