Related articles |
---|
Recursive calls to bison/flex demaille@inf.enst.fr (Akim Demaille) (1997-05-25) |
From: | Akim Demaille <demaille@inf.enst.fr> |
Newsgroups: | comp.compilers |
Date: | 25 May 1997 13:44:40 -0400 |
Organization: | ENST, France |
Keywords: | parse, yacc, question |
Hi!
I am trying to make recursive calls to a parser, with no
success. The aim is something like this:
=== file 1 ===
struct foo is
<lots of things to define a dynamic structure>
end struct
==============
=== file 2 ===
struct bar is
extension of foo
<other definitions>
end struct
==============
The parser, as a side effect, drops the structure in a hash
table, with key "foo", or "bar". When it loads file 2, if foo is yet
read, everything is OK. But if foo isn't read, then I need to call
the parser from the parser, which will load foo into the hash table,
later used to be included in bar.
So the question is: how can I do this. This is not some kind
of #include, since this is not like extending the file 1 with file 2
in it.
Does somebody have an example of this? I am using bison and
flex which seem to be ready for this, though neither documentation
explains how to combine the particularities of these two GNU tools to
achieve this.
Thanks,
Akim
--
P-mail: Akim Demaille, 107 rue Bobillot, F-75013 Paris, France
E-mail: demaille@inf.enst.fr
V-mail: +33 (1) 45-81-78-68
[Bison has a reentrant parse option which lets you call the parser
recursively. It changes the calling sequence for yylex(). -John]
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.