On Jun 20, 2012, at 8:47 AM, Matt Benson wrote:

> Hi Ter, all!
> 
>  I never did get fully functional with ANTLR 3, and returning after a
> long hiatus I find ANTLR 4 on the horizon.  :)  How time flies.  But
> getting down to business, I've been looking at ANTLR 4 for a personal
> project I'm wanting to do, have cloned it on github, and am playing
> around with it.  Some observations:
> 
> * Seemingly the codegen in v4's current code is driven by a "language"
> option in the grammar.  Notwithstanding the fact that I haven't yet
> figured out precisely where to set this if I want to toy with a new
> codegen target, if one of v4's goals is to decouple a given grammar
> from its targets, wouldn't it be more to the point to add a Tool
> option to specify the desired output language?

yep. it will be there. also grab parrt/antlr4 not antlr/antlr4 as it is the 
most up-to-date.

> 
> * Taking further some of the extensibility requests I came across in
> the ML archives, what about the idea of abstracting the notion of a
> Grammar processor, e.g.:
> 
> public interface GrammarProcessor {
>  void process(Grammar g);
> }
> 
> and
> 
> public class CodeGenPipeline implements GrammarProcessor {
>  public void process(Grammar g) {
>    ...
>  }
> }
> 
> Now Tool could accept an option of a classname specifying whatever
> kind of GrammarProcessor to use, defaulting to CodeGenPipeline.  This
> could open up some interesting possibilities.  For example, AFAICT
> there is currently no obvious way to add CodeGeneratorExtensions.
> Maybe a custom CodeGenPipeline subclass would offer an easy foothold
> for this.

Yeah, we may have to get to this as we go to other targets.  Note that the 
graph simulation to get parsing and lexing to work for adaptive LL(*) are 
extremely complicated and need to be very efficiently implemented.

> These are just some thoughts I'm kicking around as I look at v4's code
> generation.  I've got some other items I'd like advice on; these will
> explain *why* I'm looking at codegen.  ;)  I think that email is more
> properly addressed to antlr-interest, however, so stay tuned!

:)

Ter
_______________________________________________
antlr-dev mailing list
antlr-dev@antlr.org
http://www.antlr.org/mailman/listinfo/antlr-dev

Reply via email to