[antlr-interest] REAL or int or Range

Fırat Küçük firatkucuk at gmail.com
Wed Jan 9 09:14:13 PST 2008


this is my antlrworks interpreter output:



2008/1/9, Alexander Gängel <alexander at gaengel.de>:
>
>  I have a Problem in My grammar
>
> I try to decide if I got in Integer an Real or an Range like 0..9
>
> It works for Int and Real but if I input 0..9 in Antlrworks in the Input
> frame is only 9 and the Parse Tree is like ths:
>
> Where is the Rest of my Input?
>
> My grammar is like this:
> grammar test;
> start    :
>     uint_or_real
>     |(uint_or_real RANGE uint_or_real)+;
>
> uint_or_real
>     :
>     UINT
>     |REAL;
>
> REAL
>         :
>         UINT
>             (
>                     Exponent FloatTypeSuffix?
>                     |FloatTypeSuffix
>                         |
>                                 (DOT (UINT Exponent? FloatTypeSuffix?
>                         )
>                 )
>             );
>
>
> fragment
> Exponent : ('e'|'E') ('+'|'-')? UINT ;
> UINT : DIGIT_10+ ;
>
> fragment DIGIT_10 : '0'..'9' ;
>
> fragment
> FloatTypeSuffix : ('f'|'F'|'d'|'D') ;
>
> RANGE    :    '..';
> DOT    :    '.';
>
> WS    :  (' '|'\r'|'\t'|'\u000C'|'\n') {$channel=HIDDEN;};
>



-- 
Öğr. Gör. Fırat Küçük
ADAMYO Distance Learning
SAKARYA University / TURKEY
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080109/2cb03ff4/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 3680 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20080109/2cb03ff4/attachment-0001.jpe 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: result.png
Type: image/png
Size: 2723 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20080109/2cb03ff4/attachment-0001.png 


More information about the antlr-interest mailing list