/*
Yacc & Lex Test Program No.1
(C)2002 Kiyoaki Hoshino
Thanks to Hideo Araki, Kazuhide Watanabe and Kazuto Uehara.
*/
%{
#include <stdio.h>
%}
%token I
%token YOU
%token ME
%token LOVE
%token NL
%%
S : sent NL { printf("\n"); }
;
sent : subject verb object
;
subject : I { printf(" I(S) "); }
| YOU { printf(" YOU(S) "); }
;
verb : LOVE { printf(" LOVE(V) "); }
;
object : ME { printf(" ME(O). "); }
| YOU { printf(" YOU(O). "); }
;
%%
main(int argc, char *argv[])
{
fprintf(stderr,"test file, by Kiyoaki Hoshino\n");
yyparse();
fclose(stdout);
fclose(stdin);
} |