Re: YACC Parsing Question

"Jatin Bhateja" <>
12 Nov 2005 16:08:59 -0500

          From comp.compilers

Related articles
YACC Parsing Question (Pradeep) (2005-11-08)
Re: YACC Parsing Question (Jatin Bhateja) (2005-11-12)
Re: YACC Parsing Question ( (2005-11-12)
| List of all articles for this month |

From: "Jatin Bhateja" <>
Newsgroups: comp.compilers
Date: 12 Nov 2005 16:08:59 -0500
Organization: Compilers Central
References: 05-11-055
Keywords: parse
Posted-Date: 12 Nov 2005 16:08:59 EST


By using the suitable look ahead you can solve your problem. I mean to
say instead of using LR parsing use LR (k) parsing.

Let me explain it to you in detail for example consider the following
function declaration

>>void Function1 (char aname, int value)

Now on using a look ahead of one as soon as you encounter a variable whose
next token is a LEFT PARENTHESIS ( '(' )
add it to the symbol table and set its type to function as you are already

Now apart from the usual fields in the symbol table data structure you
must also have a pointer to the list of the arguments of the Function
(which will be useful only in case of function name). Thus as you
parse that argument list of the function you will be creating separate
symbol table entries for all the arguments in the symbol table plus
you will also be adding the pointers to the symbol table entries of
the arguments to the argument list field in the symbol table entry of
function name.

I hope this helps you.

Thanks and Best Regards,
Jatin Bhateja
Subject Matter Expert

Post a followup to this message

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