On Thu, 13 May 2004, Dan Sugalski wrote: > > The big problem is that I don't know *how* to implement a mixed-type > parser generator. I'm not big on parsers in general, so I'm mostly > stuck with the literature if I need to write one from scratch.
I have been thinking the following about what larry said earlier. Is this what you meant, larry? $grammar = q{ class_defn: "class" block .. etc (normal top-down stuff) ... term: { call Parse::Yapp or something } } What I mean by that weird pseudocode is that everything happens in a parse-recdescent parser, except that the production of some non-terminals calls into a bottom-up parser. That part seems trivially doable. What I need to figure out is how the bottom-up parser can relinquish control to the top-down parser if it hits a block or such. A preliminary thought: A traditional bottom-up parser can take the four actions shift, reduce, accept, and error. We will need a fifth: call the top down parser. I have not thought through how that happens or if it can be done at all. It is the only way that I currently see. I think I'll try to coax Parse::Recdescent and Parse::Yapp to work together. I have never used the latter, but the documentation seems to suggest that it can do what Bison can. Or maybe I should write two small parsers by hand (one recdescent and the other an operator precedence shift/reduce) and make them be nice to each other. --abhijit