update README, date on license.

This commit is contained in:
Terence Parr 2013-01-01 13:43:15 -08:00
parent a64187e641
commit 82dc6f7714
2 changed files with 58 additions and 30 deletions

View File

@ -1,5 +1,5 @@
[The "BSD license"]
Copyright (c) 2012 Terence Parr, Sam Harwell
Copyright (c) 2013 Terence Parr, Sam Harwell
All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,4 +1,4 @@
ANTLR v4
ANTLR v4 release candidate 1
Terence Parr, parrt at cs usfca edu
ANTLR project lead and supreme dictator for life
@ -10,17 +10,64 @@ Hi and welcome to the Honey Badger 4.0 release of ANTLR!
INSTALLATION
$ cd /usr/local/lib
$ curl -O --silent http://www.antlr.org/download/antlr-4.0-complete.jar
UNIX
Or just download from http://www.antlr.org/download/antlr-4.0-complete.jar
and put it somewhere rational for your operating system.
0. Install Java (version 1.6 or higher)
You can either add to your CLASSPATH:
1. Download
$ export CLASSPATH=".:/usr/local/lib/antlr-4.0-complete.jar:$CLASSPATH"
$ cd /usr/local/lib
$ curl -O http://www.antlr4.org/download/antlr-4.0-rc-1-complete.jar
and launch org.antlr.v4.Tool directly:
Or just download in browser using URL:
http://www.antlr4.org/download/antlr-4.0-rc-1-complete.jar
and put it somewhere rational like /usr/local/lib.
2. Add antlr-4.0-rc-1-complete.jar to your CLASSPATH:
$ export CLASSPATH=".:/usr/local/lib/antlr-4.0-rc-1-complete.jar:$CLASSPATH"
Is also a good idea to put this in your .bash_profile or whatever your
startup script is.
3. Create aliases for the ANTLR Tool, and TestRig.
$ alias antlr4='java -jar /usr/local/lib/antlr-4.0-complete.jar'
$ alias grun ='java org.antlr.v4.runtime.misc.TestRig'
WINDOWS (Thanks to Graham Wideman)
0. Install Java (version 1.6 or higher)
1. Download http://antlr.org/download/antlr-4.0-rc-1-complete.jar
Save to your directory for 3rd party Java libraries, say C:\Javalib
2. Add antlr-4.0-rc-1-complete.jar to CLASSPATH, either:
* Permanently: Using System Properties dialog > Environment variables >
Create or append to CLASSPATH variable
* Temporarily, at command line:
SET CLASSPATH=C:\Javalib\antlr-4.0-rc-1-complete.jar;%CLASSPATH%
3. Create short convenient commands for the ANTLR Tool, and TestRig,
using batch files or doskey commands:
* Batch files (in directory in system PATH)
antlr4.bat: java org.antlr.v4.Tool %*
run.bat: java org.antlr.v4.runtime.misc.TestRig %*
* Or, use doskey commands:
doskey antlr4=java org.antlr.v4.Tool $*
doskey grun =java org.antlr.v4.runtime.misc.TestRig $*
TESTING INSTALLATION
Either launch org.antlr.v4.Tool directly:
$ java org.antlr.v4.Tool
ANTLR Parser Generator Version 4.0
@ -30,35 +77,16 @@ ANTLR Parser Generator Version 4.0
or use -jar option on java:
$ java -jar /usr/local/lib/antlr-4.0-complete.jar
$ java -jar /usr/local/lib/antlr-4.0-rc-1-complete.jar
ANTLR Parser Generator Version 4.0
-o ___ specify output directory where all output is generated
-lib ___ specify location of .tokens files
...
You can make a script, /usr/local/bin/antlr4:
#!/bin/sh
java -cp "/usr/local/lib/antlr4-complete.jar:$CLASSPATH" org.antlr.v4.Tool $*
On Windows, you can do something like this (assuming you put the
jar in C:\libraries) for antlr4.bat:
java -cp C:\libraries\antlr-4.0-complete.jar;%CLASSPATH% org.antlr.v4.Tool %*
You can also use an alias
$ alias antlr4='java -jar /usr/local/lib/antlr-4.0-complete.jar'
Either way, say just antlr4 to run ANTLR now.
The TestRig class is very useful for testing your grammars:
$ alias grun='java org.antlr.v4.runtime.misc.TestRig'
EXAMPLE
In /tmp/Hello.g4, paste this:
In a temporary directory, put the following grammar inside file Hello.g4:
// Define a grammar called Hello
// match keyword hello followed by an identifier