![]() | Suggestion re tree construction |
|
08 Mar 2011, 18:35
Jerry Evans (1 post) |
I hope a 2nd edition of this book is in the pipeline. It’s a great reference and has (generally) made my recent ANTLR work much simpler. That said, I’ve some (nitpicking, sorry!) suggestions re the section on AST construction. Specifically: 1. The written material omits any discussion on the correct way to express a rewrite rule for something like this: rhs : a=rhs_alt (OR b=rhs)* ; The core issue of cardinality, IMVHO, could be described in more detail. 2. The text does not explicitly describe how you reference the left-hand side of a rule. By implication $rhs is legal but its status uncertain. 3. I know ANTLR V2 is long gone but there are still a number of decent grammars out there for V2. A few examples of translation would be good – I know there is the Wiki but the book is supposed to be the definitive reference right? Here’s an example of a V2 idion that crops up in the bison grammar
rhs
:
rhs_alt
{ ## = #( [ALT, "alt"], #rhs ); }
( OR^ rhs_alt )*
;
I hope this is constructive. best regards Jerry |
|
05 Dec 2011, 20:06
Terence Parr (33 posts) |
hi Jerry, |
| You must be logged in to comment |

