ubuntu - A Proper Explanation for the following lex/yacc example -
i having difficulty understanding following code.if possible suggest me site can read through documentations or explain code please every detail.
%{ int yylineno; %} %% ^(.*)\n printf("%4d\t%s", ++yylineno, yytext); %% int main(int argc, char *argv[]) { yyin = fopen(argv[1], "r"); yylex(); fclose(yyin); }
the code you've posted lex (or flex) code. specification lexical analyser lex (or similar flex) program generate. these days, flex more used lex although believe they're pretty compatible each other.
the official flex documentation good:
http://flex.sourceforge.net/manual/
and here's link page in manual simple examples 1 you've given explained:
http://flex.sourceforge.net/manual/simple-examples.html#simple-examples
hope helps.
Comments
Post a Comment