GCC bison flex

Fermé
m3asmi Messages postés 8 Date d'inscription dimanche 27 décembre 2009 Statut Membre Dernière intervention 21 juin 2011 - 6 juin 2010 à 12:44
Bonjour,


j'ai un problem avec la compilation de mon prog

avec la compilation GCC il me return


$gcc   -Wall	logL.c logY.c -o logique  -ll
log.y: conflits: 2 décalage/réduction
log.y:11: erreur: expected identifier or `(' before string constant
rachid@Desktop:~/Bureau/flex/projet/tes$



voila le code de log.l de flex
%{
#include <stdio.h>

 
%}
 
 
%%
 
(t|f) { yyval = atoi(yytext); return term;}
[ \t]     /* ignore whitespace */

 
%%





et le fichier bison log.y
%{
   #include <stdio.h>

   
   #include <ctype.h>

/*erreure ici !!!*/
 extern "C"
{
 	int yyparse(void);
 	int yylex(void);  
 	int yywrap()
 	{
 	 	return 1;
        }

}
  
   
%}
 
%token term
 
%left  'or'  
%left  'and'  
%right not
 
%%
 

 
expression
    : expression 'or' expression   { if ( $1 != 0)  $$ = 1;
    				     else if ($3 != 0 ) $$ = 1;
    					  else  $$ = 0 ;
    				     }
    |  expression 'and' expression   { if ( $1 != 0) { if ($3 != 0 ) $$ = 1;}
    					  else  $$ = 0 ;
    				     }
    | 'not' expression %prec not {  if ( $2 == 0) $$ = 1;
    				    else  $$ = 0  ;}
    | '(' expression ')'          { $$ = $2; }
    |  term                     { $$ = $1; } 
    ;
 
%%
 
 
 
 
void yyerror(char *s){
   printf("\n%s ", s);}
 
 
 
int main()
{

         yyparse();
}



est-ce-que vous avez une proposition?!