Patrick R. Michaud wrote:

It is possible now. I've been thinking that the way for someone to supply a custom PAST->POST transformation would be any or all of:

1.  Use the addstage(), removestage(), or stages() methods to
    change the compiler stage sequence and/or introduce new
    or replacement stages for the PAST->POST step.

Thumbs up on flexibility and ease-of-use. This is perfect.

2. Subclass the PCT::HLLCompiler class to provide a custom 'post' method that calls whatever is desired.

3.  Subclass the PAST::Compiler class to provide custom PAST->POST
    transformations that might not exist in standard PCT.

I suspect these will rarely be used. That little extra bit of complexity is enough to make compiler writers avoid it unless they really need extensive customization. Nice to have it when it's needed, though.

Given that this gives us at least three "good" ways to supply
a custom PAST->POST transformation into PCT::HLLCompiler, I didn't
think we really needed a fourth one that is specific to ostgrammars
and TGE.

Agreed. We're not at a stage of development where we need to provide extensive backward compatibility with old interfaces. addstage, etc. cover the needed feature, so ditch the old interface.

I'm also thinking that HLLGrammar may evolve slightly so that
each translator can globally register itself with HLLCompilers as
"I know how to transform something of type Foo into another thing
of type Bar".  Then an ostgrammar would simply register itself
as another PAST->POST converter, and a HLLCompiler would have some way of
saying "use the ostgrammar instead of POST::Compiler".

That has definite potential.

Allison

Reply via email to