%{ /* * A lexer for the basic grammar to use for recognizing english sentences. */ #include %} %token NOUN PRONOUN VERB ADVERB ADJECTIVE PREPOSITION CONJUNCTION %% sentence: subject VERB object { printf("Sentence is valid.\n"); } ; subject: NOUN | PRONOUN ; object: NOUN ; %% extern FILE *yyin; main() { while(!feof(yyin)) { yyparse(); } }