[antlr-interest] problems building antlr using antlr.build.Tool

John Clayton neuroboy at optonline.net
Mon May 26 09:31:15 PDT 2003


I think I may have solved my own problem (it's reaching my code where  
it's encountering errors ;-) here by setting CLASSPATH in the environ  
rather than on the command line.  I guess the tool might look for that  
when it invokes the compiler?  Could be.  Still, any feedback is  
appreciated.


On Monday, May 26, 2003, at 12:04  PM, John Clayton wrote:

> Hi Everyone,
>
> I am new to ANTLR, and foolishly making changes ;-)  So, I want to
> build the java version and following the instructions in install.html,
> I build the antlr/build/ dir, no problems there.  Then, from
> antlr-2.7.2 I run through the following:
>
> % java antlr.build.Tool build
> Exception in thread "main" java.lang.NoClassDefFoundError:
> antlr/build/Tool
>
> Ok, set the classpath to here:
>
> % java -cp . antlr.build.Tool build
> antlr.build.Tool: no such action for application antlr.build.ANTLR
> java.lang.reflect.InvocationTargetException
>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>          at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja 
> v
> a:39)
>          at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso 
> r
> Impl.java:25)
>          at java.lang.reflect.Method.invoke(Method.java:324)
>          at antlr.build.Tool.perform(Tool.java:98)
>          at antlr.build.Tool.main(Tool.java:62)
> Caused by: java.lang.NoClassDefFoundError: antlr/Tool
>          at antlr.build.Tool.antlr(Tool.java:150)
>          at antlr.build.ANTLR.build(ANTLR.java:35)
>          ... 6 more
>
>
> Hmmm, found the Tool now, but seems to have a problem reflecting a
> method in ANTLR because antlr.Tool isn't compiled.  Let's try giving it
> the jar to bootstrap:
>
> % java -cp antlr.jar:. antlr.build.Tool build
> executing: java antlr.Tool -o
> /Users/johnclay/Cocoa/Parsers/ANTLR/antlr-2.7.2-objc/antlr
> ./antlr/antlr.g
> cannot write to
> '/Users/johnclay/Cocoa/Parsers/ANTLR/antlr-2.7.2-objc/antlr/
> ANTLRParser.java'
> executing: java antlr.Tool -o
> /Users/johnclay/Cocoa/Parsers/ANTLR/antlr-2.7.2-objc/antlr
> ./antlr/tokdef.g
> cannot write to
> '/Users/johnclay/Cocoa/Parsers/ANTLR/antlr-2.7.2-objc/antlr/
> ANTLRTokdefLexer.java'
> executing: java antlr.Tool -o
> /Users/johnclay/Cocoa/Parsers/ANTLR/antlr-2.7.2-objc/antlr/preprocessor
> ./antlr/preprocessor/preproc.g
> cannot write to
> '/Users/johnclay/Cocoa/Parsers/ANTLR/antlr-2.7.2-objc/antlr/
> preprocessor/PreprocessorLexer.java'
> executing: java antlr.Tool -o
> /Users/johnclay/Cocoa/Parsers/ANTLR/antlr-2.7.2-objc/antlr/actions/java
> ./antlr/actions/java/action.g
> cannot write to
> '/Users/johnclay/Cocoa/Parsers/ANTLR/antlr-2.7.2-objc/antlr/actions/
> java/ActionLexer.java'
> executing: java antlr.Tool -o
> /Users/johnclay/Cocoa/Parsers/ANTLR/antlr-2.7.2-objc/antlr/actions/cpp
> ./antlr/actions/cpp/action.g
> cannot write to
> '/Users/johnclay/Cocoa/Parsers/ANTLR/antlr-2.7.2-objc/antlr/actions/
> cpp/ActionLexer.java'
> executing: java antlr.Tool -o
> /Users/johnclay/Cocoa/Parsers/ANTLR/antlr-2.7.2-objc/antlr/actions/
> csharp ./antlr/actions/csharp/action.g
> cannot write to
> '/Users/johnclay/Cocoa/Parsers/ANTLR/antlr-2.7.2-objc/antlr/actions/
> csharp/ActionLexer.java'
> executing: javac -d . ./antlr/*.java
> ./antlr/ANTLRGrammarParseBehavior.java:10: package
> antlr.collections.impl does not exist
> import antlr.collections.impl.BitSet;
>                                ^
>
>
> Ok, so it has permissions problems and some compiler errors.  Let's
> deal with permissions:
>
> % sudo java -cp antlr.jar:. antlr.build.Tool build
> executing: java antlr.Tool -o
> /Users/johnclay/Cocoa/Parsers/ANTLR/antlr-2.7.2-objc/antlr
> ./antlr/antlr.g
> executing: java antlr.Tool -o
> /Users/johnclay/Cocoa/Parsers/ANTLR/antlr-2.7.2-objc/antlr
> ./antlr/tokdef.g
> ./antlr/tokdef.g:175:36: warning:lexical nondeterminism between alts 1
> and 2 of block upon
> ./antlr/tokdef.g:175:36:     k==1:'0'..'9'
> ./antlr/tokdef.g:175:36:     k==2:'\u0003'..'\u00ff'
> ./antlr/tokdef.g:175:44: warning:lexical nondeterminism between alts 1
> and 2 of block upon
>
>
> ... processing lots of g files with lots of nondeterminism errors ...
>
> executing: javac -d . ./antlr/*.java
> ./antlr/ANTLRGrammarParseBehavior.java:10: package
> antlr.collections.impl does not exist
> import antlr.collections.impl.BitSet;
>                                ^
>
> ... ad infinitum ...
>
>
> All right, we have fixed everything except that now as soon as the
> build tool starts compiling it wigs out and can't find anything.  I
> tried sending in:
> -Dantlr.build.root=/Users/me/antlr-2.7.2 (on OS X) but got:
> antlr.build.Tool: Property antlr.build.root==/Users/me/antlr-2.7.2 does
> not exist
>
> Can anyone point me in the right direction?  Thanks a whole big bunch.
> I'll keep horsing with the classpath.
>
>
> Regards,
>
> John Clayton
>
> ----------------------------------
> neuroboy at optonline.net
> ----------------------------------
> How glorius it is to be an Exception, and how painful.
>
>
>
>
> Your use of Yahoo! Groups is subject to  
> http://docs.yahoo.com/info/terms/
>
>
>
Regards,

John Clayton

----------------------------------
neuroboy at optonline.net
----------------------------------
Ask a question, remain a fool for five minutes
Don't ask a question, remain a fool forever


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list