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: Fri, 7 Mar 2003 09:51:17 -0800

Hi Akim,

  I think you have almost solved my parser problem. 

  However there is one thing that hast to do manually. Each pure parser
has use a different lexer name to call the yylex(). For example, 

  '-p html' is used for html.y. In the html html.bison.tab.c, yylex()
becomes htmllex(). 

  '-p javascript' is used for for javascript.y. In the
javascript.bison.tab.c, yylex() becomes javascriptlex().

  However in the recursive parsing the two lexers htmllex() and
javascripts() should use the same input stream and they must be renamed
to yylex() manually.

  In a word, using multiple *.y files is one step close to support
recursive parsing. However how to share a common lexer is still an
issue.

Thanks 

Xinan Tang
Senior MTS
Xambala Inc
2025 Gateway Place, Suite 130
San Jose, CA 95110
Ph # (408)-436-2208   
_________________________________________________

-----Original Message-----
From: Akim Demaille [mailto:address@hidden 
Sent: Friday, March 07, 2003 3:34 AM
To: Xinan Tang
Cc: Carl Cerecke; address@hidden
Subject: Re: "Recursive parsing"


 Xinan> Hi Carl,
 Xinan> Thanks for your input.

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

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

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

Sorry, but I fail to see the problem.  Do not try to have two
grammars, to parser implementations, within the same compilation unit
(*.c).  Rather, have several *.y, several *.c, and in one of them,
just invoke fooparse.




reply via email to

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