[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "Recursive parsing"
From: |
Carl Cerecke |
Subject: |
Re: "Recursive parsing" |
Date: |
Fri, 07 Mar 2003 14:07:37 +1300 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021130 |
Xinan Tang wrote:
Hi
In O’reilly book “ Lex & yacc “ written by John R. Levine etc., it
discussed a way to support recursive parsing, i.e. during parsing
grammar A yyparse() is called again to parse grammar B. This is very
typical in parsing a HTML file, in which some script program may be
embedded in the same HTML file. However the way that is suggested is to
manually rename some C variables and make them local to yyparse() (page
209 -210 in the book).
Has anyone tried to support recursive parsing in bison, especially
writing a grammer for HTML and its script languages?
It's quite simple in bison (if I remember correctly).
The yy prefix for all the important variables/functions etc. can be
changed with the appropriate option. So one parser could be yyparse(),
and the other could be zzparse().
Cheers,
Carl.