help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: "Recursive parsing"


From: Xinan Tang
Subject: RE: "Recursive parsing"
Date: Thu, 6 Mar 2003 17:23:27 -0800

Hi Carl,

  Thanks for your input.

  However it doesn't work by simply using '-p' option. 

  For example the tables (arrays) such as yytable[], yydefact[], and
yypact[] are still using the same names. Please remember that in the
recursive parsing these tables should be different for different
grammars.
Ideally it should be html_yy_table for HTML and xml_yy_table for XML
parsing.

  That is why in the O'reilly book, it suggests using renaming and make
these arrays local to yyparse(). However one has to use 'sed' to do it
:(

Thanks
  
Xinan Tang
Senior MTS
Xambala Inc
2025 Gateway Place, Suite 130
San Jose, CA 95110
Ph # (408)-436-2208   
_________________________________________________
-----Original Message-----
From: Carl Cerecke [mailto:address@hidden 
Sent: Thursday, March 06, 2003 5:08 PM
To: Xinan Tang
Cc: address@hidden; Debashis Chatterjee
Subject: Re: "Recursive parsing"

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.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]