[antlr-interest] (no subject)

Imre András iar73 at freemail.hu
Fri Oct 31 16:36:09 PDT 2008


Hi,

I'm playing with ANTLRWorks 1.2.1. When I try to debug my grammar, the result is a compile error, unreachable statement. Any hints on how to correct this?

Please find the grammar and the console error message included at the bottom.


Thanks,
  András

--- unreachable.g --------------------
grammar unreachable;

ID  :   ('a'..'z'|'A'..'Z')+ ;
DEFINES : '::=' ;
WS  :   (' '|'\t')+ {skip();} ;

prog:   stat+ ;
                
stat:   assignment;

assignment    :    leftValue WS* DEFINES WS* rightValue {System.out.println($leftValue.value + "=" + $rightValue.value);};

leftValue returns [String value]:    ID {return $ID.text;};
rightValue returns [String value]:    ID {return $ID.text;}| sequence {return $sequence.value;};

sequence returns [String value]:    'SEQUENCE' WS* '{' WS* e=rightValue {$value=$e.value;} (WS* ',' WS* e=rightValue {$value += $e.value;})* WS* '}' {return $value;};


--- console tab --------------------
[00:10:23] C:\Documents and Settings\iar\My Documents\output\unreachableParser.java:419: unreachable statement
[00:10:23]                     break;
[00:10:23]                     ^
[00:10:23] C:\Documents and Settings\iar\My Documents\output\unreachableParser.java:435: unreachable statement
[00:10:23]                     break;
[00:10:23]                     ^
[00:10:23] 2 errors

--- end of info ---
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20081101/10f9b0d6/attachment.html 


More information about the antlr-interest mailing list