Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 antlr 文档中,我看到了以下两条规则,但它们的描述听起来完全一样。这两个规则有什么区别...
a : INT ID -> ID INT ; // reorder nodes a : ^(ID INT) -> ^(INT ID) ; // flip order of nodes in tree
另外,为什么不这样写第二条规则,或者那会和第一条规则一样,所以规则之间没有区别?
a : ^(INT ID) -> ^(ID INT) ;
谢谢,院长
^(INT ID)
INT
ID
INT ID