c - lex and yacc — combine two lexers and one yacc -
i have 2 lex files functions xxlex() , yylex() , have 1 yacc grammar file. wanted on grammatical rule invoke xxlex(). xxlex() called once, , want invoked always. how do it?
by default, yacc grammars call yylex() obtain new tokens.
if want call xxlex() of time, arrange call yylex() @ appropriate times.
if want xxlex() called every time, either rename yylex() , rename original xxlex() zzlex(), or use bison -p xx (including parser function) starts xx instead of yy. (the same flag, -p, works posix-compliant yacc. flex program takes -p xx generate symbols starting xx instead of yy; posix lex not have option so, i've seen many makefile sed script edits source generated lex change prefix yy other letters such xx.)
Comments
Post a Comment