ANTLR, ANother Tool for Language Recognition, is a language tool that provides a framework for constructing recognizers, interpreters, compilers, and translators from grammatical descriptions containing actions in a variety of target language.(see for more information). It was writen in Java and requires JDK to compile java sources. You can download jdk from sun website.
Download and install JDK and ANTLR is not difficult. For JDK, just download it from sun web site, run the bin file and it will begin to install automatically. As to ANTLR, just download the tar.gz file, and unpack it to the location you prefered to.
But it was not ENOUGH. They must be configured to work normally. The configurations here means to set the coresponding envirement varibles, such as $PATH and $CLASSPATH.
1. JDK Path
I installed JDK in the location: /home/yyc/tools/, so the .bash_profile in my home directory was modified, with following path added:
PATH=$PATH:$HOME/bin:\
/$HOME/tools/bin:\
/home/yyc/tools/bin:\
/home/yyc/tools/jdk1.6.0_12/jre/bin
|
2. CALSSPATH setting
.bashrc in my home director was moddified to add required CLASSPATH, as follows:
exportCLASSPATH=$CLASSPATH:\
.\
:/home/yyc/ANTLR/antlr-3.1.2/lib/antlr-2.7.7.jar:\
/home/yyc/ANTLR/antlr-3.1.2/lib/antlr-3.1.2.jar:\
/home/yyc/ANTLR/antlr-3.1.2/lib/antlr-runtime-3.1.2.jar:\
/home/yyc/ANTLR/antlr-3.1.2/lib/stringtemplate-3.2.jar:\
/home/yyc/tools/jdk1.6.0_12/lib:\
/home/yyc/tools/jdk1.6.0_12/lib/tools.jar
|
This is easy indeed, BUT notice there is a "." after the formar $CALSSPAH.
DO NOT FORGET IT. Or, you will receive some error. (Which wasted me 1 hour to resolve this god damn problem).
阅读(694) | 评论(0) | 转发(0) |