I have some confusing question which make me run in a loop, please help me to understand them.
if I have two file one is
.y
which is the parser file and the second is the.l
lexical analyzer can I use theyytext
in the parser file, should I define theyylex
there to use it or not?there is a default
yyerror
function if I want to change it should I declare it in the parser file in the section of the declarations?if in the lex file I return a token to the parser something like this:
[0-9] return DIGIT; what is passed to the parser the DIGIT with the digit found or just the digit itself without the DIGIT?
how can I use
yylineno
in the parser file ,because I need the parser to useyylineno
and tell where did the error happened and what token caused that?in the parser file when I write a rule like this:
exp -> exp |/empty/
is it the same as
exp ->/*empty*/ |exp
I appreciate anyone who could help me with those question because they had confused me,thanks in advance