[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bison problem shift/reduce
From: |
alnet |
Subject: |
Bison problem shift/reduce |
Date: |
Wed, 11 Apr 2007 04:33:18 -0700 (PDT) |
I'm new to the flex/bison stuff and I get an error message. Can you spot the
error please?
I believe that the marked line is the cause to the error I get. But I don't
know any other way, how to make this recursive statement to be parsed.
%{
#include <stdio.h>
#include <string.h>
void yyerror(const char *str)
{
fprintf(stderr,"error: %s\n",str);
}
int yywrap()
{
return 1;
}
main()
{
yyparse();
}
%}
%token CREATE OBRACE EBRACE INCLUDE QUOTE FILENAME PARAM LINK MAP CONSIST
ATTRIBUTE EQUAL DOT
%left DOT
%left EQUAL
%%
commands: /*empty*/
| commands command
;
command:
CREATE ATTRIBUTE OBRACE defenitions EBRACE {printf("CREATE OBRACE
defenitions EBRACE");};
|
INCLUDE QUOTE FILENAME QUOTE {printf("INCLUDE QUOTE FILENAME
QUOTE");}
|
INCLUDE QUOTE ATTRIBUTE QUOTE {printf("INCLUDE QUOTE FILENAME
QUOTE");}
;
defenitions: /*empty*/
|
defenitions defenition
;
defenition: /*empty*/
|
PARAM OBRACE attribute EBRACE {printf("PARAM OBRACE attribute
EBRACE");}
|
LINK OBRACE attribute EBRACE {printf("LINK OBRACE attribute
EBRACE");}
|
MAP OBRACE attribute EBRACE {printf("MAP OBRACE attribute EBRACE");}
|
CONSIST OBRACE defenition EBRACE {printf("CONSIST OBRACE
attribute
EBRACE");}
;
attribute:
attribute_s
|
attribute_s EQUAL attribute_s {printf("ATTRIBUTE EQUAL ATTRIBUTE");}
;
attribute_s:
ATTRIBUTE {printf("ATTRIBUTE");}
|
attribute_s DOT attribute_s {printf("ATTRIBUTE DOT ATTRIBUTE");}
;
--
View this message in context:
http://www.nabble.com/Bison-problem-shift-reduce-tf3558697.html#a9937395
Sent from the Gnu - Bison - Help mailing list archive at Nabble.com.
- Bison problem shift/reduce,
alnet <=