/* File........ tokens.lex * Contents.... rules to get tokens from standart input * * Compilation: * flex tokens.lex * gcc -o parser5.exe parser5.c lexyy.c */ /* ---------------- Definitions space ----------------- */ %option noyywrap %{ #include "tokens.h" %} /* ------------------- Rules space -------------------- */ %% [a-zA-Z][0-9a-zA-Z]* return VARIABLE; [0-9]+ return DIGIT; [\+\-\/\*] return OPERATOR; \= return EQUALS; \:\= return ASSIGN; \; return SEPARATOR; [\ ]+ \n . return ERROR; %%