[antlr-interest] ANTLR installation/use on Unix

Gary R. Van Sickle g.r.vansickle at att.net
Sun Nov 30 01:06:30 PST 2008


> From: Jim Idle
> 
> On Fri, 2008-11-28 at 21:28 -0600, Gary R. Van Sickle wrote: 
> 
> 	
> 	Hi Terence et al,
> 	
> 	Am I just getting old, or shouldn't I be able to (in a 
> More Ideal World(tm),
> 	of course) do something like this on a Unix-like box?:
> 	
> 	$ cd antlr-src-distro-dir/
> 	$ make install
> 	$ antlr --version
> 
> 
> Well, ANTLR is a Java tool,

It's a tool.  There's no reason the user should have to care what language
it's implemented in simply in order to use it.  Gcc is written in C, but I
don't care about that when I use it to compile C++, Fortran, or Java code.
I don't actually know what languages Flex or Bison are written in (though I
of course have a pretty good idea), but that doesn't in the least prevent me
from invoking them like this:

	$ flex [whatever]
	$ bison [whatever]

Is there a reason why I shouldn't be able to do the equivalent with ANTLR?

> so make install only works for 
> the C runtime distribution (after a ./configure).
> 

Right, but I'm talking about the ANTLR tool itself, not any of its
language-specific runtimes.

> The ANTLR source can be bult from scratch now using maven though:
> 
> 1) In stall Maven 2.0.9 or better;
> 2) Find the directories with pom.xml in them
> 3) cd to them and type: mvn
> 4) Look at the output of the build to see where the .jar 
> files go if are not familiar with Maven.
> 

I'm less concerned with the building of it than the installation and use of
it.  Can I do this?:

	$ cd antlr-src-distro-dir/
	$ mvn install
	$ antlr [whatever]

Like I said, it's the 20th century.  I, as the user, shouldn't have to be
"looking at the output" of anything, picking out the "artifacts" (as the
kids call 'em these days), worrying about where they should go, and then
have to move them manually.  As you indicated above, I don't have to with
the C runtime, why should I have to for the tool itself?

> Note that the Maven build, as well as constructing the ANTLR 
> .jar file also creates a complete executable (I.e Java -jar) 
> jar file that includes all the dependencies  to make things 
> easier for developers.
> 

Ok, so can't it go the last mile and also create a simple shell script
wrapper so I can:

	$ antlr MyGrammar.g

?  In fact, rumor has it that the Maven tool of which you speak uses exactly
that approach itself.

To answer my own question, I broke out my autotools- and script-fu last
night and rolled an automake+autoconf+built-shell-script which does in fact
allow me to:

	$ ./configure
	$ make
	$ make install
	$ antlr
	ANTLR Parser Generator  Version 3.1.1
	[etc etc]

The JARs aren't actually built, but rather the pre-built one in the source
distro's /lib directory is installed, and the "antlr" shell script is
generated from a template (a default Java interpreter and the path to the
JAR are substituted).  "make install" puts everything in reasonable places
and, Bob's your uncle, everything works just as it should.

Terence (or anybody), any interest in this?  I could certainly BSD-license
it and contribute it.

-- 
Gary R. Van Sickle



More information about the antlr-interest mailing list