[antlr-interest] V4 Feature Request: Externally loadable target generators

Stephen Gaito stephen at perceptisys.co.uk
Fri Sep 21 18:49:54 PDT 2012


Sam,

This sounds excellent!

(How can I help?)

Regards,

Stephen Gaito

On 22/09/12 02:46, Sam Harwell wrote:
> I definitely disagree with the "should" regarding implementation as an IDE plugin, and can confidently say we won't be implementing targets in this manner.
>
> When I build the first real port, I'll be working to ensure the target extension mechanism allows dynamically adding target support and doesn't require any target files to be built into the ANTLR tool or reside in the antlr4 GitHub repository.
>
> Sam
>
> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Douglas Godfrey
> Sent: Friday, September 21, 2012 3:00 PM
> To: Stephen Gaito
> Cc: Antlr-Interest Antlr.Org
> Subject: Re: [antlr-interest] V4 Feature Request: Externally loadable target generators
>
> This should be implemented via the existing Netbeans Plugin mechanism.
> One of the default Plugin Repositories should be downloads.antlr.org.
>
> When you first launch ANTLRWorks4 you would use the Tools::Plugins menu
> to install the AntlrV4 targets of your choice. ANTLRWorks4 already uses
> the Netbeans Plugin mechanism [9 plugins] but it does not have any
> plugin repository configured.
>
> This would mean that each AntlrV4 Target would need to be packaged as a
> library and wrapped in a Netbeans Plugin shell.
>
>
>
> On 9/21/12 3:29 PM, "Stephen Gaito" <stephen at perceptisys.co.uk> wrote:
>
>> Ter,
>>
>> *Problem:*
>>
>> Maybe I missed it, but one of the serious drawbacks I found in using
>> your excellent ANTLR V3, was the inability of cleanly loading a new or
>> slightly altered target (C/C++/Java/...) generator.
>>
>> If I remember correctly in reading through the Java code for the Tool,
>> the list of the various target generators were hard-coded into the Tool.
>>
>> If my memory is correct, to load my own generator I would need to alter
>> your code... which, if I were to open-source my own project, would get
>> seriously messy... with a (potential) proliferation of different forks
>> of ANTLR.  (Or alternatively with a very large number of "pull" requests
>> back into the main project).
>>
>> *Request:*
>>
>> As the community begins to develop or port targets for the ANTLR v4, it
>> would be nice to have a clean way of developing and deploying targets
>> which exist /outside/ of the official ANTLR4 project.
>>
>> *Benefits:*
>>
>> This should make maintaining the core ANTLR4 project much easier, and it
>> would allow users of ANTLR v4 more flexibility in their choice of targets.
>>
>> For example, from Sam's comments on the "standard" C++ target, this C++
>> target /might/ make use of "external" dependencies which /might/
>> preclude the use of a generated grammar inside, for example, the PHP
>> engine.
>>
>> If ANTLR v4 allowed externally loadable target generators, then I (for
>> example) might be able to make simple changes to the standard C++ target
>> (or alternatively write my own) so that grammars generated using my
>> generator would be embeddable inside, for example, the PHP engine.
>>
>> Then in my (eventually) open-source project I could distribute an
>> additional jar file to be loaded at runtime.  This additional jar file
>> could, cleanly, contain "my" version of the C++ target generator as
>> required by my project.  (Of course I would also provide my C++ target
>> as an un-official but, hopefully,  useful GitHub project).
>>
>> *Possible implementation?*
>>
>> I know that ANTLR v4 now makes extensive use of Java's reflection
>> mechanisms.  Could you use this reflection mechanism to find externally
>> loadable target generator interfaces?
>>
>> Alternatively, could you search for all instances of a suitably named
>> file in the resources to load any external target generator?
>>
>> Regards,
>>
>> Stephen Gaito
>>
>>
>>
>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>> Unsubscribe:
>> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
>



More information about the antlr-interest mailing list