%{ #include<stdio.h>; %} %% if|else|while|for|switch|int|char {printf("keyword");} [a-z]([a-z][0-9])* {printf("id");} [0-9]* {printf("number");} .* {printf("invalid");} %% main(){ yylex(); }
gfg 123 _abc12 #abc
Standard output is empty
ERROR: /home/NigvD3/prog:12:0: Syntax error: Unexpected end of file ERROR: '$runtoplevel'/0: Undefined procedure: program/0 Exception: (3) program ? [3] program Exception: (3) program ? ERROR: '$runtoplevel'/0: Undefined procedure: program/0 Exception: (3) program ? ERROR: Unknown option (h for help) Exception: (3) program ? EOF: exit