Hello,
I did install antlr-3.2 on Linux x86_64 as below -
I. Antlr-3.2 Installation:
1. mkdir antlr
2. Downloaded source code (antlr source distribution) from *
http://antlr.org/download.html* in above antlr folder/PATH.
3. Untarred the source distribution using “tar -zvxf
antlr-3.2.tar.gz” and did get -
antlr-3.2/BUILD.txt antlr-3.2/antlr3-maven-plugin
antlr-3.2/antlrjar.xml antlr-3.2/antlrsources.xml antlr-3.2/gunit
antlr-3.2/gunit-maven-plugin antlr-3.2/pom.xml antlr-3.2/runtime
antlr-3.2/tool
4. mkdir antlr-toolchain
5. cd antlr-toolchain (copy antlr-3.2.jar here)
6. jar -xvf antlr-3.2.jar
ABOVE COMPLETES INSTALLATION.
II. Running a tutorial Expr.g & Test.java as posted in
http://www.antlr.org/wiki/display/ANTLR3/Expression+evaluator
1. In top folder of antlr as created above, I create a folder "mkdir
examples" and do copy Expr.g and Test.java here
2. Perform below -
- export
CLASSPATH=/home/mukkaysh/antlr/antlr-toolchain
- Copy the grammar example (Expr.g & Test.java) from
*http://www.antlr.org/wiki/display/ANTLR3/Expression+evaluator*
- Using command "java org.antlr.Tool Expr.g"
generates Lexer (.java), Parser (.java) & Tokens files.
- Using command "javac Test.java ExprLexer.java
ExprParser.java" generates class files. but with below message -
-----
[user]$ javac Test.java ExprLexer.java
ExprParser.java
Note: ExprParser.java uses unchecked or unsafe
operations.
Note: Recompile with -Xlint:unchecked for details.
-----
As, uses of -Xlint generates all warnings, did try as below -
[user]$ javac Test.java ExprLexer.java
ExprParser.java -Xlint
ExprParser.java:179: warning: [unchecked] unchecked
call to put(K,V) as a member of the raw type java.util.HashMap
memory.put((ID2!=null?ID2.getText():null), new
Integer(expr3));
^
1 warning
----
I believe this warnings are not so important, but when I do -
----
[user]$ ls
Expr.g ExprLexer.class ExprLexer.java ExprParser.class
ExprParser.java Expr.tokens Test.class Test.java
[user]$ java Test
Exception in thread "main" java.lang.NoClassDefFoundError:
Test
Caused by: java.lang.ClassNotFoundException: Test
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native
Method)
at
java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:319)
at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:264)
at
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:332)
Could not find the main class: Test. Program will exit.
-----
I get above execution error messages.
I am totally newbie to ANTLR and Java. Any clue for above warnings and final
execution of Test file.
~BR
-----
--
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address