help-bison
[Top][All Lists]
Advanced

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

Problem : $1 include laters $N


From: capdevielle marc
Subject: Problem : $1 include laters $N
Date: Wed, 14 Nov 2001 02:47:04 -0500

Hello,

  Using bison for my little project, I have a problem that the info doc
couldn't answer. So here's my problem :

When having something like ():
%{
something(char* str){...};
%}


%union
{
 char* union;
}

%token <string>WORD
%token EOL

%%

input : 
      | WORD WORD EOL {something($1);something($2) }
      ;

%%

 
the $1 variable contains $2 even if WORD as a definition like
[A-Za-z0-9] in lex and that lex sends back to bison two separated
tokens.

for a line in a file to parse containing something like :

aword anotherword

lex returns two token WORDS, one with the yytext set to "aword" and the
other with yytext set to "anotherword". The problem is that in bison, $1
contains "aword anotherword" and $2 "anotherword".

Feedback would be great.
I didn't subscribe to the mailing list so CC me the anwsers. thanks.

Marc



reply via email to

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