|Recursive yacc parser ? email@example.com (1990-09-18)|
|From:||firstname.lastname@example.org (Vegetable Man)|
|Date:||Tue, 18 Sep 90 11:36:52 PDT|
As part of a project for work, I am about to undertake the
dubious task of modifying YACC or Bison to generate a parser
which can be called recursively. The general idea of the project
is to use a database to resolve external references in a
source file. The problem is that the definition returned from
the database may contain yet more unresolved references, so the
parser would be called again. I have seen a few mentions of
this sort of thing, but noone who's claimed to have done it.
Has anyone? Does anyone have any references to offer? I
will probably be using Bison, since source is freely available.
Unless there is general interest, e-mail me and I will post a
Hughes Network Systems 10792 Roselle Street San Diego, CA 92121
[Making a yacc parser recursive is quite simple. In the parser skeleton,
usually called /usr/lib/yaccpar, there are a bunch of static parser state
variables called yyv, yys, yypv, yyps, yystate, yytmp, yynerrs, yyerrflag,
and yychar. Make them all automatics in yyparse, and your parser should
work recursively. No changes to yacc itself should be needed. Bison
should be similar. -John]
Return to the
Search the comp.compilers archives again.