linux - Lex file unrecognized rule -
i trying run following program, , getting unrecognized rule: 37. not sure why giving me error in line 37.
command: $ lex mycsv2html.l
%{ //definition section #include <stdin.h> #include <stdout.h> int c; extern int yylval; %} %% // rule section " " ; [\n] { c = yytext[0]; yylval = c - '\n'; return(br); } ["] { c = yytext[0]; yylval = c - ''; return(''); } [<] { c = yytext[0]; yylval = c - ''; return('<'); } [>] { c = yytext[0]; yylval = c - ''; return('>'); } int main(void) //c code section { /* call lexer, quit. */ yylex(); return 0; }
you should add %%
between second part (rules) , third part(c codes).
..... [>] { c = yytext[0]; yylval = c - ''; return('>'); } %% // here int main(void) //c code section .....
Comments
Post a Comment