/* File: woof1.l Simple example of a lex file. Compile using: lex woof1.l gcc lex.yy.c */ %option noyywrap %{ #include %} %% treat { printf("\n!!!%s!!! Woof! yummy!\n", yytext) ; } walk { printf("\n!!!%s!!! Woof! where's the leash?\n", yytext) ;} dinner { printf("\n!!!%s!!! Woof! I'm hungry!\n", yytext) ;} good\ dog { printf("\n!!!%s!!! Woof! talking about me!\n", yytext) ;} \n { printf("\n") ; } . { printf(".") ; } %% int main(int argc, char **argv) { yylex(); return 0 ; }