diff --git a/LICENSE.txt b/LICENSE.txt index db3e9b116..47a177082 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,5 +1,5 @@ -[The "BSD license"] -Copyright (c) 2011 Terence Parr +[The "BSD license"] +Copyright (c) 2012 Terence Parr, Sam Harwell All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/README.txt b/README.txt index a3ad9658a..c0a0f55be 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -ANTLR v4 early access +ANTLR v4 Terence Parr, parrt at cs usfca edu ANTLR project lead and supreme dictator for life @@ -6,4 +6,84 @@ University of San Francisco INTRODUCTION -Coming soon... +Hi and welcome to the Honey Badger 4.0b1 release of ANTLR! + +INSTALLATION + +$ cd /usr/local/lib +$ curl -O --silent http://www.antlr.org/download/antlr-4.0b1-complete.jar + +Or just download from http://www.antlr.org/download/antlr-4.0b1-complete.jar +and put it somewhere rational for your operating system. + +You can either add to your CLASSPATH: + +$ export CLASSPATH=".:/usr/local/lib/antlr-4.0b1-complete.jar:$CLASSPATH" + +and launch org.antlr.v4.Tool directly: + +$ java org.antlr.v4.Tool +ANTLR Parser Generator Version 4.0b1 + -o ___ specify output directory where all output is generated + -lib ___ specify location of .tokens files +... + +or use -jar option on java: + +$ java -jar /usr/local/lib/antlr-4.0b1-complete.jar +ANTLR Parser Generator Version 4.0b1 + -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: + +// Define a grammar called Hello +// match keyword hello followed by an identifier +// match lower-case identifiers +grammar Hello; +r : 'hello' ID ; +ID : [a-z]+ ; +WS : [ \t\n]+ -> skip ; // skip spaces, tabs, newlines + +Then run ANTLR the tool on it: + +$ cd /tmp +$ antlr4 Hello.g4 +$ javac Hello*.java + +Now test it: + +$ grun Hello r -tree +hello parrt +^D +(r hello parrt) + +(That ^D means EOF on unix; it's ^Z in Windows.) The -tree option prints +the parse tree in LISP notation. + +BOOK SOURCE CODE + +http://pragprog.com/titles/tpantlr2/source_code \ No newline at end of file diff --git a/build.properties b/build.properties index 1cdd5fba6..a4fef712a 100644 --- a/build.properties +++ b/build.properties @@ -1,4 +1,4 @@ version=4.0b1 -antlr3.jar=/usr/local/lib/antlr-3.4-complete.jar +antlr3.jar=/usr/local/lib/antlr-3.5-complete.jar build.sysclasspath=ignore diff --git a/build.xml b/build.xml index dc45098fa..d96e6f351 100644 --- a/build.xml +++ b/build.xml @@ -4,9 +4,9 @@ Make build.properties like this: -version=4.0ea +version=4.0b1 -antlr3.jar=/usr/local/lib/antlr-3.4-complete.jar +antlr3.jar=/usr/local/lib/antlr-3.5-complete.jar build.sysclasspath=ignore -->