8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 17:23:04 +01:00
firebird-mirror/extern/btyacc/test/test.y
2006-04-19 09:53:27 +00:00

33 lines
504 B
Plaintext

%{
/* first section */
%}
%%
%{
/* second section */
%}
S : /* empty */ { printf("S -> epsilon\n"); }
| '(' S ')' S { printf("S -> ( S ) S\n"); }
%ifdef ABC
/* see how preprocessor can be used */
| '*' { printf("S -> *\n"); }
%endif
;
%%
#include <stdio.h>
main() {
printf("yyparse() = %d\n",yyparse());
}
yylex() {
int ch;
do { ch = getchar(); } while (ch == ' ' || ch == '\n' || ch == '\t');
if (ch == EOF) return 0;
return ch;
}
yyerror(s) char*s; {
printf("%s\n",s);
}