[antlr-interest] A question on Mr. Parr's book--Page 45

Bryan S Follins asalh at mindspring.com
Wed Jul 22 17:27:04 PDT 2009


Chap 3, page 45:

There is a snippet of code that reads:

prog:	stat+

stat:	expr NEWLINE
    |	ID '=' expr NEWLINE
    | NEWLINE
    ; 

If I attempt to make a small grammar to test this, like the following:

Grammar P;

prog:	stat+

stat:	expr NEWLINE
    |	ID '=' expr NEWLINE
    | NEWLINE
    ; 

Will the grammar work in ANTLR Works?  When I try, I get "reference to
undefined rule: expr."  How do I
correct that error?



More information about the antlr-interest mailing list