Related articles |
---|
yacc and lex htwais@isd-pm.de (1996-02-09) |
From: | htwais@isd-pm.de (Helmut Wais) |
Newsgroups: | comp.compilers |
Date: | 9 Feb 1996 14:22:14 -0500 |
Organization: | Customer of EUnet Germany; Info: info@Germany.EU.net |
Keywords: | interpreter, question |
I'm new with lex and yacc. Trying to write something like a
interpreter (using yacc because there is no yaic). It should scan a
file with a description of a data-format and at the same time scan the
data-file. Now there is something like:
while( field[0] == 'x' )
{
...
next field;
}
in the description-file. yacc is reading this once, finding it
syntactically correct. For the data-file i have to pass the body of
the loop more than once. I'm thinking 'bout an array of function
pointers that are executed when yacc reduces to a while-statement, for
each statement in the loop a pointer in the array.
Now i'm not very happy with this. Does anybody have a better idea ?
Help me please, Thank you.
[The array of function pointers approach is pretty popular. I've sure used
it a lot. -John]
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.