JavaCC入门 [英] Getting started with JavaCC

查看:276
本文介绍了JavaCC入门的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是JavaCC的新手,无法弄清楚如何让它运行。我使用的是Mac OS X,我安装了javacc-6.0.zip并解压缩。我无法在我的路径中访问javacc脚本,因为在终端上输入 javacc 我收到以下消息:

I am new to JavaCC and cannot figure out how to get it running. I am using Mac OS X and I installed javacc-6.0.zip and unzipped it. I am unable to make the javacc script accessible from my path as on typing javacc on the terminal I get the following message:

    -bash: javacc: command not found

如何我可以从我的路径访问javacc脚本吗?

How do I make the javacc script accessible from my path?

我的解压缩文件夹 javacc-6.0 位于以下目录中: / Users / Rishabh / Desktop / javacc

My unzipped folder javacc-6.0 is in the following directory: /Users/Rishabh/Desktop/javacc

所以我在终端上执行以下操作:

So I do the following on the terminal:

    PATH=$PATH\:/Users/Rishabh/Desktop/javacc/javacc-6.0/

键入 javacc next给我相同的信息。

Typing javacc next gives me the same message.

推荐答案

我今天下载的JavaCC 6.0版本(2013.07.22)没有完整的bin目录。它缺少所有脚本文件!希望这很快就会得到解决。

The version of JavaCC 6.0 that I downloaded today (2013.07.22) did not have a complete bin directory. It was missing all the script files! Hopefully this will be remedied soon.

对于OS X和其他unix / linux变体,丢失的脚本文件名为javacc,应该是可执行的,并且应该包含以下内容:

For OS X and other unix/linux variants, the missing script file is called javacc, should be executable, and should contain the following:

#!/bin/sh
JAR="`dirname $0`/lib/javacc.jar"

case "`uname`" in
     CYGWIN*) JAR="`cygpath --windows -- "$JAR"`" ;;
esac

java -classpath "$JAR" javacc "$@"

将bin目录添加到PATH中(省略反斜杠 - 正如Ahmed Masud所指出的那样)并且所有这些都应该是警告。如果您的操作系统来自Redmond,或者您想运行jjtree或jjdoc,只需下载javacc-5.0并将脚本文件(不是lib目录!!!!)从5.0 bin目录复制到6.0 bin目录。

Add the bin directory to your PATH (omitting the backslash -- as pointed out by Ahmed Masud) and all should be ticketty boo. If your OS comes from Redmond or you want to run jjtree or jjdoc, just download javacc-5.0 and copy the script files (NOT the lib directory!!!!) from the 5.0 bin directory to the 6.0 bin directory.

这篇关于JavaCC入门的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆