/* File........ parser1.lex * Contents.... Exemple of small parser usin LEX * * compilation: * flex parser1.lex * gcc -o parser1.exe lexyy.c */ /* ---------------- Definitions space ----------------- */ %option noyywrap %{ #include #include #include #include %} /* ------------------- Rules space -------------------- */ %% ^aa[ab]*$ {printf("\nThe match was : %s", yytext);} . {} %% /* ----------------- User code space ------------------ */ main() { printf("Listing matches for 'All words starting with aa'.\n"); yylex(); }