|
From: | Fiordean Dacian |
Subject: | what's wrong here? (shift/reduce problem) |
Date: | Thu, 27 Jun 2002 14:58:24 +0200 |
Hi all,
I don't have a solution yet for my problem, but
I've the same comportament in a much simpler grammer, which I'm saying that's
the same kind of error.
The lexer:
/* macros
*/
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]; } The parser:
%union
{ char* string_type; } %token <string_type> TK_NAME
%type <string_type> name
%type <string_type> parameter_list %type <string_type> with_possible_parameter_list %%
name
: TK_NAME ; with_possible_parameter_list
: '(' parameter_list ')' { $$=$2; } | /* empty */ { $$=0; } parameter_list
: name { $$ = $1; } | name ',' parameter_list { char s[1024] = {'\0'}; strcpy(s, $1); if
(strlen(s))
strcat(s, ","); strcat(s, $3); char *ret = new char[strlen(s) + 1]; strcpy(ret, s); $$ = ret; delete $1; delete $3; } ; For the input:
(1)
I get parsing error. Why's that ?????
Thanks,
// D.
|
[Prev in Thread] | Current Thread | [Next in Thread] |