|recursive parser & manual parser conflicts email@example.com (Avin Patel) (2002-03-17)|
|From:||Avin Patel <firstname.lastname@example.org>|
|Date:||17 Mar 2002 22:55:45 -0500|
|Keywords:||parse, question, comment|
|Posted-Date:||17 Mar 2002 22:55:45 EST|
I have created a recursive parse using bison. Also some token I am
parsing manually. So my compiler has hand written scanner(lexer). So I
have one scanner, that I pass back & through between manual parsing &
recursive bison parser. But the problem I am facing over here is that
when I use bison parser, It looks one more token when there is a case
of conflicts & that is also a end of the portion of text it has to
parse, so recursive parser doesn't puts it back in to scanner, I have
try to get rid of that by using YYACCEPT, But actually YYACCEPT is
telling parser that you are done, but desn't tell that whatever one
lookahead token it has used from scanner to put it back, & after that
my manual parser comes, it not able to get that one token for scanner.
I tried yyunput() but it is not working too. Do I have to implement
yyunput, Is there any better way to tell parser to tell scanner that
you have to put your token back.
Recursive parser is just reading part of the file, This problem
doesn't come if I am reading whole file.
[I'd try really hard to see if I could parse the language with one parser
rather than trying to recurse yourself. Dealing with yacc's lookahead is
usually a losing battle. -John]
Return to the
Search the comp.compilers archives again.