recursive parser & manual parser conflicts

Avin Patel <>
17 Mar 2002 22:55:45 -0500

          From comp.compilers

Related articles
recursive parser & manual parser conflicts (Avin Patel) (2002-03-17)
| List of all articles for this month |

From: Avin Patel <>
Newsgroups: comp.compilers
Date: 17 Mar 2002 22:55:45 -0500
Organization: Compilers Central
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.

Thank you

Avin Patel
[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]

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.