[antlr-interest] org.antlr.Tool outputs to wrong directory onWindows in antlr-3.1.3

George S. Cowan cowang at comcast.net
Sat Apr 11 11:13:37 PDT 2009


There seems to be some things going on here that are not documented in the
command-line documentation at
http://www.antlr.org/wiki/display/ANTLR3/Command+line+options. (I am only a
sometime Unix user so please let me know if there are assumptions about
command-line options that I am missing.) The documentation says, in part, 

Usage:
  java org.antlr.Tool [args] file.g [file2.g file3.g ...]

-o outputDir | specify output directory where all output is generated; 
               search for token vocabularies in here also 

Note that there is no mention of extending the specified path using info
from the grammar path. Please tell me how to specify that the path will be
extended and how to specify that it will not. Even better, just update the
Wiki information or point to where this is already documented.

Also Martin's command line, below, is parsing two different grammars with a
-lib between them. I know that in some Unix command-line tools arguments can
be interspersed with target-file names and the order in which things appear
on the command-line is important. Does the org.antlr.Tool command line use
of -lib operate this way, so that a different -lib could be in effect for
each grammar? Does this also apply to all the other options so that, for
instance, -o could be used to change the output directory for each grammar?

George


> -----Original Message-----
> From: Jim Idle [mailto:jimi at temporal-wave.com] 
> Sent: Friday, April 03, 2009 10:36 AM
> To: Martin Probst
> Cc: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] org.antlr.Tool outputs to wrong 
> directory onWindows in antlr-3.1.3
> 
> 
> Martin Probst wrote:
> > Hi,
> >
> > this may sound weird, but we're running into a problem with 
> our build
> > system since we upgraded from antlr-3.1.2 to antlr-3.1.3, 
> and it only
> > happens on Windows (so we only have 30% unhappy developers now, but
> > still ;-)).
> >
> > What happens is that if you run (and this is what our build 
> effectively does):
> > mkdir -p ../../tmp/com/xhive/xquery/parser
> > java -classpath ../../lib/misc/antlr-3.1.3.jar org.antlr.Tool -o
> > ../../tmp/ com/xhive/xquery/parser/XQueryParser.g -lib
> > ../../tmp/com/xhive/xquery/parser
> > com/xhive/xquery/parser/XQueryTreeParser.g
> >
> > This will on Mac OS X and on Linux boxes create XQueryParser.java in
> > ../../tmp/com/xhive/xquery/parser, and this is what we expect.
> >   
> Yes, it should do that.
> > Running this with antlr-3.1.3 on Windows will create 
> XQueryParser.java
> > in ../../tmp, without the package paths. I'm pretty sure 
> that this is
> > a regression from antlr-3.1.2 where it didn't happen.
> >   
> Yes, it would be. However, as far as I can tell, the only reason it 
> would do this on Windows is if the JRE does not make File() 
> work in the 
> same way as on UNIX, or of there is a hard coded directory separator 
> (which there isn't I think), or that the ../ relative path 
> isn't working 
> correctly (this seems most likely).
> > Now we can fix this by specifying the full path as the output
> > directory ("-o ../../tmp/com/xhive/xquery/parser"), but that seems
> > unelegant, and also I'd like to know what the expected behaviour
> > should be.
> >   
> As per your experience with UNIX.
> 
> Jim
> 
> 



More information about the antlr-interest mailing list