bison look ahead token problem

"Avin Patel" <>
11 Dec 2001 21:32:22 -0500

          From comp.compilers

Related articles
bison look ahead token problem (Avin Patel) (2001-12-11)
| List of all articles for this month |

From: "Avin Patel" <>
Newsgroups: comp.compilers
Date: 11 Dec 2001 21:32:22 -0500
Organization: Compilers Central
Keywords: yacc, parse, comment
Posted-Date: 11 Dec 2001 21:32:22 EST

I have made a seperate parser for reading the text buffer.
Now the rule is completed by just reading only part of that text buffer,
than I forcefully complete the rule without error by calling YYACCEPT, but
at the end of the rule it reads one more extra token, How can i stop it to
read any further token before YYACCEPT.
I mean to say
I have text buffer like

Now in this texts I am completing 2 rules
another is INTEGER
seperator is comma
But when I use my parser than at the end of the rule it reads one more token
',' & I am missing by my seperator.

I am not doing like
        | rule1lisr ',' rule1

I am just reading reading rule1, than doing some my own work, than again I
am coming back, assigning lexer to parser & reading another rule.
Thank you
[That's how LALR parsers work. If you don't want readahead at the end,
you'll have to figure out some way for the lexer to know that it's done.

Post a followup to this message

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