[antlr-interest] ANTLR 3 Eclipse Plugin

Shmuel Siegel ssiegel at finjan.com
Tue Jun 19 05:50:05 PDT 2007


I would be very happy with having a "grammar" folder marked as an
eclipse source folder and having the java files generated in "src" with
the same structure. So, for instance, if my package is "prog.generated"
the grammar will be grammar/prog/generated/prog.g3 and it will generate
the file in src/prog/generated/progParser.java. Is this possible? Maybe
there will need to be a workspace/project/file option that declares the
source folder to use for the generated java file.

-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of
scott at javadude.com
Sent: Tuesday, June 19, 2007 3:30 PM
To: antlr-interest at antlr.org
Subject: Re: [antlr-interest] ANTLR 3 Eclipse Plugin

Source/target will work for maven (or other command-line builders), but
to
make things work properly in eclipse, I need to have it generate the
java
files into a source dir in eclipse, which will then be compiled by the
java builder.

At work, I've set up a "generated" source folder for some other builders
I've worked on (I think it was for xmlbeans, or it might have been SMC -
oh -- that reminds me... I need to release my SMC builder!) I did the
same
dir-mapping you mention here.

I'll have to see if I can set that up. I'd like to keep the dir
structure
flexible so it doesn't force/preclude a specific command-line build
approach. (We use ant at my work, though there's been talk about
switching
to maven). Maven's strict on dir structure, so I've gotta be sure I'm
friendly with it ;)

Later,
-- Scott



> On Tue, Jun 19, 2007 at 01:24:57PM +0300, Shmuel Siegel wrote:
>> In the meantime, I have one suggestion that I will take from the
antlr3
>> ant task. I like the idea of having a grammar folder outside of the
src
>> folder. The generated code is then put in the right place. It would
be
>> great if you can detect the package statement and automatically put
the
>> code in the right place.
>
> FYI, the approach I've tried to take in the Maven2 plugin is to just
> have source and target folder-structures match.  i.e. if you place the
> grammar file in $src/com/example, the output files will be generated
> within $dest/com/example (well, the actual structure is more complex,
> but you get the idea).  This doesn't require any additional inspection
> inside the grammar file :)
>
>
> ta,
> dave
>
> --
> http://david.holroyd.me.uk/
>




More information about the antlr-interest mailing list