On Tue, Dec 04, 2007 at 12:54:43PM -0500, istarex wrote:
> Is it possible to compile a single PGE grammar against multiple sets
> of actions to get multiple different parsers?  This would be good for
> Lisp-like languages where you have one parser that spits out PIR code
> and a parser that is invoked for "(read)" calls and spits out
> s-expression objects.  Both would work off the same grammar, but the
> different actions allow for different outputs from the parsers.

Yes.  In fact, in PGE any actions to be performed are supplied as 
a runtime argument to the grammar, so one doesn't even have to 
recompile the grammar to get this behavior.

For example, a few days ago it occurred to me that NQP and perl6
could potentially share the same parse grammar definition, but
simply differ in the actions that each performs.  NQP would
simply ignore or stub out those constructs that it doesn't
choose to implement.

Pm

Reply via email to