salut !
j'ai un problem avec la compilation de mon prog
avec la compilation GCC il me return
voila le code de log.l de flex
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 logL.c:1097: attention : yyunput defined but not used logL.c:1140: attention : input defined but not used log.y:12: erreur: expected identifier or ( before string constant log.y: In function main: log.y:81: attention : control reaches end of non-void function rachid@Desktop:~/Bureau/flex/projet/tes$
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 %{ #include <stdio.h> %} %% (t|f) { yyval = atoi(yytext); return term;} [ \t] /* ignore whitespace */ %%
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 %{ #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?!
Partager