[antlr-interest] Grammar issue
Kevin J. Cummings
cummings at kjchome.homeip.net
Wed Mar 23 07:36:13 PDT 2011
On 03/23/2011 05:41 AM, maulattu wrote:
> Ok Jim, let me understand if I'm missing something with a short example.
> Take this little section of the grammar
>
> parameter_with_index
> : parameterName = 'PARAM_' parameterIndex '=' numericLiteral
> ;
>
>
> It shall be changed to
>
> parameter_with_index
> : parameterNameLiteral parameterIndex separator numericLiteral
> ;
> parameterNameLiteral
> : PARAM_TOKEN
> ;
> separator
> : SEPARATOR_TOKEN
> ;
> SEPARATOR_TOKEN
> : '='
> ;
> PARAM_TOKEN
> : 'PARAM_'
> ;
>
> is it right?
No,
prameter_with_index
: PARAM_TOKEN parameterIndex SEPERATOR_TOKEN numericLiteral
;
PARAM_TOKEN
: 'PARAM_'
;
SEPERATOR_TOKEN
: '='
;
should be sufficient. No need for the extra 2 rules.
> Thank you all for your precious suggestions :)
--
Kevin J. Cummings
kjchome at verizon.net
cummings at kjchome.homeip.net
cummings at kjc386.framingham.ma.us
Registered Linux User #1232 (http://counter.li.org)
More information about the antlr-interest
mailing list