%token ENTIER REEL VECTOR INTEGER FLOAT CONST READ DISPLAY IF ELSE FOR END AND OR NOT G L GE LE EQ DI ACOUV AT
%token ACFER AFFEC PLUS MOIN MUL DIV CROOUV CROFER PAROUV PARFER SEP VERG PVERG DEUXPT ESPACE ID CAR CHCAR STRING
%start S
%%
S: ID ACOUV DEC CODE ACFER;
J'ai ce message qui apparait lorse que je fait bison -d prog.y :
fatal error: start symbol S does not derive any sentence
bison -don your input gives me:which tells you exactly what the problem is -- you're using
CODEandDECand not defining them. Add them to one of the%tokenlines and it works fine...edit
The error 'start symbol S does not derive any sentence' is telling you that you have unbounded recursion in your grammar, so that no (finite) input can match the start symbol. In you case,
Smust include aCODE, which must include acommand(directly or via alistcommand), which must contain aboucle, which must in turn contain anotherlistcommand. So you end up with an infinite expansion chain oflistcommands->command->boucle->listcommands.The problem is probably your rule
which matches exactly one command, plus a useless (and ambiguous) unbounded noop-expansion of that command. You probably want
which matches 0 or more
commands in sequence. Making this change fixes the fatal error, but still leaves a bunch of shift-reduce conflicts, along with the useless ruledectype: dectype.To track down and fix shift/reduce conflicts, use
bison -vto produce a.outputfile listing the grammar, states and conflicts in detail. Most of yours come from not having a precedence forNOT, and the other two come from the ambiguousdectypeandCODErules.