[antlr-interest] Proposal to make writing language targets a biteasier

Sam Harwell sharwell at pixelminegames.com
Mon Jan 19 18:16:13 PST 2009


Here's what I'm working on in the C# port:

If a target class is not present in the executable (Antlr3.exe), it
tries to load Antlr3.Target.<targetname>.dll, then check for the target
in there. Then it has the target return a StringTemplateGroup that knows
the location of the .stg file, whether embedded in the satellite
assembly or located on disk.

Sam

-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Rick Mann
Sent: Monday, January 19, 2009 7:51 PM
To: antlr-interest Interest
Subject: [antlr-interest] Proposal to make writing language targets a
biteasier

I have grander plans, but this suggestion I think is easy to implement.

First, re-org the source directories so that the runtime, Java  
and .stg files for a given language are kept under a combined  
directory structure. The Maven build would probably need to be  
modified to allow it to find the Java files in an arbitrary location  
(this way, I can work on my language target and check it into my own  
version control until it's ready for submission).

Second, modify the 'language' option to accept an absolute path. The  
ANTLR tool can look for a path separator in the value, and it would  
use this directory (or some directory under it) on disk, rather than  
relative to the classpath, for loading the .stg files. The actual  
language string would come from the last component of the path. This  
allows me to skip recompiling for changes in .stg files alone, and  
dramatically speeds up development.

I hard-coded the path in ANTLR to point to my templates directory, so  
it's working for me, but this should be a pretty easy change to make.  
I'd happily code it up and submit a patch, if you like (although I may  
miss some places where it's used).

-- 
Rick


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