t_bonner@oscar.hac.com (Vegetable Man) (09/19/90)
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 summary. matt bonner t_bonner@oscar.hns.hac.com 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] -- Send compilers articles to compilers@esegue.segue.boston.ma.us {ima | spdcc | world}!esegue. Meta-mail to compilers-request@esegue.