29 |
|
|
30 |
#define YYSTYPE int |
#define YYSTYPE int |
31 |
static YYSTYPE exprMerge (YYSTYPE x0, YYSTYPE x1); |
static YYSTYPE exprMerge (YYSTYPE x0, YYSTYPE x1); |
32 |
|
int yylex (void); |
33 |
|
int yyerror (char const *msg); |
34 |
%} |
%} |
35 |
|
|
36 |
|
|
54 |
|
|
55 |
static YYSTYPE exprMerge (YYSTYPE x0, YYSTYPE x1) |
static YYSTYPE exprMerge (YYSTYPE x0, YYSTYPE x1) |
56 |
{ |
{ |
57 |
|
(void) x0; |
58 |
|
(void) x1; |
59 |
printf ("<OR>\n"); |
printf ("<OR>\n"); |
60 |
return 0; |
return 0; |
61 |
} |
} |
62 |
|
|
63 |
int main() |
int |
64 |
|
main (void) |
65 |
{ |
{ |
66 |
yyparse(); |
yyparse(); |
67 |
return 0; |
return 0; |
68 |
} |
} |
69 |
|
|
70 |
int yyerror(char const *msg) |
int |
71 |
|
yyerror (char const *msg) |
72 |
{ |
{ |
73 |
printf("%s\n", msg); |
printf("%s\n", msg); |
74 |
exit(4); |
exit(4); |
75 |
} |
} |
76 |
|
|
77 |
|
|
78 |
int yylex() |
int |
79 |
|
yylex (void) |
80 |
{ |
{ |
81 |
while (1) { |
while (1) { |
82 |
int ch = fgetc(stdin); |
int ch = fgetc(stdin); |
93 |
[glr-regr1.y: warning: 1 shift/reduce conflict |
[glr-regr1.y: warning: 1 shift/reduce conflict |
94 |
]) |
]) |
95 |
AT_COMPILE([glr-regr1]) |
AT_COMPILE([glr-regr1]) |
96 |
AT_CHECK([[echo BPBPB | ./glr-regr1]], 0, |
AT_CHECK([[echo BPBPB | ./glr-regr1]], 0, |
97 |
[[E -> 'B' |
[[E -> 'B' |
98 |
E -> 'B' |
E -> 'B' |
99 |
E -> E 'P' E |
E -> E 'P' E |