salut !

j'ai un projet qui est cree en flex et bison sur calculatrice Logique

voila le code de log.l
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
%{
#include <stdio.h>
#include "logY.h"
extern void yyerror(char *);
extern int yyval;
 
%}
 
t  T|t
f  F|f
 
%%
 
(t|f) { yyval = atoi(yytext); return term;}
[ \t]     /* ignore whitespace */
 
<<EOF>>   yyterminate();  /* signal end of dialogue */
 
\n        return yytext[0];
.         return yytext[0];
 
%%
et le fichier bison log.y
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*  file name : log.y  */
 
/*  Calculator grammar for arithmetic expressions.      */
/*  Associativity and precedence declarations used to   */
/*  disambiguate the grammar.                           */
 
%{
   #include <stdio.h>
   #include <stdlib.h>
 
   #include <ctype.h>
 
   extern FILE* yyin;
   extern int yylex(void);
 
 
 
   void yyerror(char *);
   void clearAllRegisters(void);
 
   double factorial(double);
%}
 
%token term
 
%left  'or'  
%left  'and'  
%right not
 
%%
 
input
    :  /* empty */
    |  input line
    ;
 
line
    : '\n'
    |  expression '\n'            {  printf ("\t= %d\n", $1); }
    ;
 
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; if($1 != 0) printf("\ttrue\n");
    						else printf("\t fasle"); } 
    ;
 
%%
 
 
 
 
void yyerror(char *s){
   printf("\n%s ", s);}
 
 
 
int main()/*int argc,char** argv)
{
  if (argc>1){
    if (fopen(argv[1],"r") == NULL){
         printf("Can't read from %s\n",argv[1]);
         return 0;
    } else
         yyin = fopen(argv[1],"r");
  } else
         yyin = stdin;
         printf(">> ");
         yyparse();
}*/
{ 
//if (yyparse(c) == 0 )
printf("expression correcte\n");
 }
avec la compilation GCC il me return

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
read: 4: arg count
/tmp/cc65bOW8.o: In function `yylex':
logL.c:(.text+0x22f): undefined reference to `yyval'
logL.c:(.text+0x3df): undefined reference to `yywrap'
/tmp/cc65bOW8.o: In function `input':
logL.c:(.text+0xddb): undefined reference to `yywrap'
collect2: ld a retourné 1 code d'état d'exécution
rachid@Desktop:~/Bureau/flex/projet$
est-ce-que vous avez une proposition?!