yacc help

"Vinceinhiding" <vinceinhiding@pacbell.net>
22 Mar 2003 16:09:01 -0500

          From comp.compilers

Related articles
yacc help vinceinhiding@pacbell.net (Vinceinhiding) (2003-03-22)
| List of all articles for this month |

From: "Vinceinhiding" <vinceinhiding@pacbell.net>
Newsgroups: comp.compilers
Date: 22 Mar 2003 16:09:01 -0500
Organization: Prodigy Internet http://www.prodigy.com
Keywords: yacc, question
Posted-Date: 22 Mar 2003 16:09:01 EST

I am making a parser in yacc with a grammar for a small language
similar to C. My problem is that I am not sure how to display in the
output what the current action of the parser is. My program shows the
token names for each token that has been read and then it should
output the next parsing action that yacc does.


like so...


int functionName( int input) {...


should produce something like:


INT <<parsing actions>>
id <<parsing actions>>
( <<parsing actions>>
INT <<pasrsing actions>>
) <<parsing actions>>
{ <<parsing actions>>
....


The <<parsing actions>> will either display <<shift>> or <<reduce #>>, the #
being the production that is used in the grammar. How would I define this
output in grammar?


thanks for any help
[Turn on YYDEBUG and the parser will show it for you. -John]



Post a followup to this message

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