help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: simply don't get it!!


From: Tim Van Holder
Subject: Re: simply don't get it!!
Date: 28 Jun 2002 14:02:49 +0200

On Fri, 2002-06-28 at 13:54, Fiordean Dacian wrote:
> Hi group,
> 
> parser:
> 
> %union
> {
>  char* string_type;
> }
> 
> 
> %token <string_type> TK_NAME
> 
> %type <string_type> name
> %type <string_type> with_possible_parameter_list
> 
> %%
> 
> name
>  : TK_NAME
>  ;
> 
> with_possible_parameter_list
>  : '(' name ')'
>   { 
>    $$=$2; 
>   }
>  | '(' error ')'
>   {
>    $$=0;
>   }
>  ;
> 
> 
> I can't consume an input like:
> 
> (abc)

Unless I'm completely mistaken, the above grammar will consume a single
NAME token ONLY ('name' is the start rule, and accepts exactly one
TK_NAME).

Try again with '%start with_possible_parameter_list' after your %type
lines, or with 'with_possible_parameter_list' as the first rule in the
grammar.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]