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

Terence Parr parrt at cs.usfca.edu
Wed Jul 22 17:28:20 PDT 2009


Hi Bryan, you need to define rule expr. :)
Ter
On Jul 22, 2009, at 5:27 PM, Bryan S Follins wrote:

> 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?
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address



More information about the antlr-interest mailing list