Advertisement
Guest User

Lucas Hermann Negri

a guest
Oct 7th, 2008
490
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.36 KB | None | 0 0
  1. /* Definitions */
  2. DIGIT           [0-9]
  3. VALID           [a-zA-Z]
  4. IDENTIFIER      [a-zA-Z][a-zA-Z0-9]*
  5. WHITE           [\t\n\r]
  6.  
  7. /* Rules */
  8. %%
  9. {IDENTIFIER}        printf("Identifier: %s\n", yytext);
  10. {DIGIT}+"."{DIGIT}+ printf("Float: %s\n", yytext);
  11. {DIGIT}+        printf("Integer: %s\n", yytext);
  12. {WHITE}+        /* ignore */
  13. .           printf("Not known: %s!\n", yytext);
  14. %%
  15.  
  16. int main()
  17. {
  18.     yylex();
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement