help-bison
[Top][All Lists]
Advanced

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

RE : address@hidden don't get it!!


From: Olivier . ORTIGUES
Subject: RE : address@hidden don't get it!!
Date: Fri, 28 Jun 2002 14:11:31 +0200

It can't work.

By default the starting rule is the first one in your grammar.

So it, is trying to match 'name'.

If you want to match your expression you must begin your grammar with
'with_possible_parameter_list'

Or you can add '%start with_possible_parameter_list' in the decl section of
your grammar.

By the way, with the grammar delow you must have on your bison's results one
useless rule.

Regards.

-----Message d'origine-----
De: Fiordean Dacian [mailto:address@hidden
Date: vendredi 28 juin 2002 13:55
À: address@hidden
Objet: simply don't get it!!


Hi group,

I guess I'm penible with this...but I'm simply don't get it ??!!

lexer:

BLANK       [ \t\n]
LETTER       [A-Za-z]
DIGIT       [0-9]
NATIONAL      address@hidden|\}\~\^]
ALPHA       {LETTER}|{DIGIT}|{NATIONAL}
WORD       ({ALPHA}|".")*{ALPHA}({ALPHA}|".")*
OTHER       [\?\&]
SPECIAL       [\+\-\%\!\/\>\*\(\)\"\,\=\:]
NQTEXT       {ALPHA}|{OTHER}|{SPECIAL}|[\.\_\ \;]
STRING       [^;]+
NAME       {WORD}("_"{WORD})*
%%

{NAME} {
   xxlval.string_type = new char[strlen(xxtext) + 1];
   strcpy(xxlval.string_type, xxtext);
   return TK_NAME; 
  }

.       {
        return xxtext[0];
       }


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)


Anyone could help me out?

// D.



reply via email to

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