JJTree and javacc

Hello,

I am now learning how to use javacc. My task is to create an abstract syntax tree. My software should receive a piece of code written in a language called Rainbow, where it will then create an abstract syntax tree. I have never used javacc or jjtree but I have the grammar of the language already which is very liitle. Could you please guide me in some way please?

Thanks in advance.

PS: I tried to work with jjtree examples but where it says to type: ant eg1 , I get the message that ant is not a recognised command.

[550 byte] By [Giannis3a] at [2007-10-2 21:35:41]
# 1

> Hello,

>

> I am now learning how to use javacc. My task is to

> create an abstract syntax tree. My software should

> receive a piece of code written in a language called

> Rainbow, where it will then create an abstract syntax

> tree. I have never used javacc or jjtree but I have

> the grammar of the language already which is very

> liitle. Could you please guide me in some way

> please?

Your best bet is to be more careful with the examples. You're asking a lot for someone to tutor you in JavaCC that way.

> Thanks in advance.

> PS: I tried to work with jjtree examples but where it

> says to type: ant eg1 , I get the message that ant is

> not a recognised command.

Install Ant on your machine and add its /bin directory to your PATH. That's the problem, not JavaCC.

%

duffymoa at 2007-7-14 0:49:45 > top of Java-index,Java Essentials,New To Java...
# 2
thanks,how do i add the classpath in windows?
Giannis3a at 2007-7-14 0:49:45 > top of Java-index,Java Essentials,New To Java...
# 3
How do you expect to use JavaCC if you don't know how to set CLASSPATH?You add Ant's /bin to the PATH, not CLASSPATH.Go to Start->Settings->Control Panel->System->Advanced->Environment Variables and add the path to Ant's /bin to your PATH.%
duffymoa at 2007-7-14 0:49:45 > top of Java-index,Java Essentials,New To Java...
# 4
PATH has to do with the Windows OS and finding apps, not Java. CLASSPATH is for Java.What you're doing is telling Windows how to find Ant's startup script ant.cmd when you type "ant" in a command shell.%
duffymoa at 2007-7-14 0:49:45 > top of Java-index,Java Essentials,New To Java...
# 5
I add the following to user variables and systems variables but it doesnt work when I type ant in command promptC:\Documents and Settings\Jaap\Desktop\apache-ant-1.6.5-bin\apache-ant-1.6.5\bin
Giannis3a at 2007-7-14 0:49:45 > top of Java-index,Java Essentials,New To Java...
# 6
The spaces in the path are a problem. Enter the DOS equivalents for the path.[CODE]set ANT_HOME=C:\Docume~1\Jaap\Desktop\apache-ant-1.6.5-bin\apache-ant-1.6.5\binset PATH=%ANT_HOME%\bin;%PATH%[/code]%
duffymoa at 2007-7-14 0:49:45 > top of Java-index,Java Essentials,New To Java...
# 7
The spaces in the path are a problem. Enter the DOS equivalents for the path.set ANT_HOME=C:\Docume~1\Jaap\Desktop\apache-ant-1.6.5-bin\apache-ant-1.6.5\binset PATH=%ANT_HOME%\bin;%PATH%%
duffymoa at 2007-7-14 0:49:45 > top of Java-index,Java Essentials,New To Java...
# 8
Thank you very very much!one small thing again...... it says unable to locate tools.jar
Giannis3a at 2007-7-14 0:49:45 > top of Java-index,Java Essentials,New To Java...
# 9

Please read the Tomcat docs:

http://tomcat.apache.org/tomcat-5.0-doc/setup.html

"Java location: The installer will use the registry or the JAVA_HOME environment variable to determine the base path of the JDK or a JRE. If only a JRE (or an incorrect path) is specified, Tomcat will run but will be unable to compile JSP pages at runtime. Either all webapps will need to be precompiled (this can be easily done using the Tomcat deployer), or the lib\tools.jar file from a JDK installation must be copied to the common\lib path of the Tomcat installation."

Try setting a JAVA_HOME environment variable that points to where you've installed Java and see if that helps. Otherwise, copy the tools.jar from the Java /bin directory to your Tomcat /common/lib.

I don't like that solution, but do it if JAVA_HOME doesn't help.

%

duffymoa at 2007-7-14 0:49:45 > top of Java-index,Java Essentials,New To Java...