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

Stephen Gaito stephen at perceptisys.co.uk
Fri Sep 21 13:10:02 PDT 2012


Douglas,

Alas, sorry to be difficult, but I do not use Netbeans :$

I only use that stinking old command line (I /am/ an old unix hack).

However, adding a Netbeans requirement to an open-source project which 
is not Java based (such as I intend mine to be), would seriously impinge 
wider take-up... so is not really an option for my needs.

Regards,

Stephen Gaito

On 21/09/12 21:00, Douglas Godfrey wrote:
> 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
>



More information about the antlr-interest mailing list