Skip to content

Commit

Permalink
Update version in many files to 4.13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
parrt committed May 21, 2023
1 parent a9639d0 commit c630cb6
Show file tree
Hide file tree
Showing 36 changed files with 112 additions and 110 deletions.
30 changes: 15 additions & 15 deletions doc/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ That command creates `antlr4` and `antlr4-parse` executables that, if necessary,

```bash
$ antlr4
Downloading antlr4-4.12.0-complete.jar
Downloading antlr4-4.13.0-complete.jar
ANTLR tool needs Java to run; install Java JRE 11 yes/no (default yes)? y
Installed Java in /Users/parrt/.jre/jdk-11.0.15+10-jre; remove that dir to uninstall
ANTLR Parser Generator Version 4.12.0
ANTLR Parser Generator Version 4.13.0
-o ___ specify output directory where all output is generated
-lib ___ specify location of grammars, tokens files
...
Expand Down Expand Up @@ -130,7 +130,7 @@ ExprBaseListener.h ExprLexer.h ExprListener.h ExprParser.h

ANTLR is really two things: a tool written in Java that translates your grammar to a parser/lexer in Java (or other target language) and the runtime library needed by the generated parsers/lexers. Even if you are using the ANTLR Intellij plug-in or ANTLRWorks to run the ANTLR tool, the generated code will still need the runtime library.

The first thing you should do is probably download and install a development tool plug-in. Even if you only use such tools for editing, they are great. Then, follow the instructions below to get the runtime environment available to your system to run generated parsers/lexers. In what follows, I talk about antlr-4.12.0-complete.jar, which has the tool and the runtime and any other support libraries (e.g., ANTLR v4 is written in v3).
The first thing you should do is probably download and install a development tool plug-in. Even if you only use such tools for editing, they are great. Then, follow the instructions below to get the runtime environment available to your system to run generated parsers/lexers. In what follows, I talk about antlr-4.13.0-complete.jar, which has the tool and the runtime and any other support libraries (e.g., ANTLR v4 is written in v3).

If you are going to integrate ANTLR into your existing build system using mvn, ant, or want to get ANTLR into your IDE such as eclipse or intellij, see [Integrating ANTLR into Development Systems](https://github.com/antlr/antlr4/blob/master/doc/IDEs.md).

Expand All @@ -140,38 +140,38 @@ If you are going to integrate ANTLR into your existing build system using mvn, a
1. Download
```
$ cd /usr/local/lib
$ curl -O https://www.antlr.org/download/antlr-4.12.0-complete.jar
$ curl -O https://www.antlr.org/download/antlr-4.13.0-complete.jar
```
Or just download in browser from website:
[https://www.antlr.org/download.html](https://www.antlr.org/download.html)
and put it somewhere rational like `/usr/local/lib`.

if you are using lower version jdk, just download from [website download](https://github.com/antlr/website-antlr4/tree/gh-pages/download) for previous version, and antlr version before 4.12.0 support jdk 1.8
if you are using lower version jdk, just download from [website download](https://github.com/antlr/website-antlr4/tree/gh-pages/download) for previous version, and antlr version before 4.13.0 support jdk 1.8

2. Add `antlr-4.12.0-complete.jar` to your `CLASSPATH`:
2. Add `antlr-4.13.0-complete.jar` to your `CLASSPATH`:
```
$ export CLASSPATH=".:/usr/local/lib/antlr-4.12.0-complete.jar:$CLASSPATH"
$ export CLASSPATH=".:/usr/local/lib/antlr-4.13.0-complete.jar:$CLASSPATH"
```
It's 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 -Xmx500M -cp "/usr/local/lib/antlr-4.12.0-complete.jar:$CLASSPATH" org.antlr.v4.Tool'
$ alias grun='java -Xmx500M -cp "/usr/local/lib/antlr-4.12.0-complete.jar:$CLASSPATH" org.antlr.v4.gui.TestRig'
$ alias antlr4='java -Xmx500M -cp "/usr/local/lib/antlr-4.13.0-complete.jar:$CLASSPATH" org.antlr.v4.Tool'
$ alias grun='java -Xmx500M -cp "/usr/local/lib/antlr-4.13.0-complete.jar:$CLASSPATH" org.antlr.v4.gui.TestRig'
```

### WINDOWS

(*Thanks to Graham Wideman*)

0. Install Java (version 1.7 or higher)
1. Download antlr-4.12.0-complete.jar (or whatever version) from [https://www.antlr.org/download.html](https://www.antlr.org/download.html)
1. Download antlr-4.13.0-complete.jar (or whatever version) from [https://www.antlr.org/download.html](https://www.antlr.org/download.html)
Save to your directory for 3rd party Java libraries, say `C:\Javalib`
2. Add `antlr-4.12.0-complete.jar` to CLASSPATH, either:
2. Add `antlr-4.13.0-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.12.0-complete.jar;%CLASSPATH%
SET CLASSPATH=.;C:\Javalib\antlr-4.13.0-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 and grun.bat
Expand All @@ -197,7 +197,7 @@ Either launch org.antlr.v4.Tool directly:

```
$ java org.antlr.v4.Tool
ANTLR Parser Generator Version 4.12.0
ANTLR Parser Generator Version 4.13.0
-o ___ specify output directory where all output is generated
-lib ___ specify location of .tokens files
...
Expand All @@ -206,8 +206,8 @@ ANTLR Parser Generator Version 4.12.0
or use -jar option on java:

```
$ java -jar /usr/local/lib/antlr-4.12.0-complete.jar
ANTLR Parser Generator Version 4.12.0
$ java -jar /usr/local/lib/antlr-4.13.0-complete.jar
ANTLR Parser Generator Version 4.13.0
-o ___ specify output directory where all output is generated
-lib ___ specify location of .tokens files
...
Expand Down
6 changes: 3 additions & 3 deletions doc/go-changes.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Changes to the Go Runtime over time

## v4.12.0 to v4.12.1
## v4.12.0 to v4.13.0

Strictly speaking, if ANTLR was a go only project following [SemVer](https://semver.org/) release v4.12.1 would be
Strictly speaking, if ANTLR was a go only project following [SemVer](https://semver.org/) release v4.13.0 would be
at least a minor version change and arguably a bump to v5. However, we must follow the ANTLR conventions here or the
release numbers would quickly become confusing. I apologize for being unable to follow the Go release rules absolutely
to the letter.
Expand Down Expand Up @@ -176,4 +176,4 @@ there are no magic answers. I will look in more detail at improvements for such
memory until the parse is finished (improved 100x in experiments).

The best advice I can give is to put some effort in to the actual grammar itself. well-formed grammars will potentially
see some huge improvements with this release. Badly formed grammars, not so much.
see some huge improvements with this release. Badly formed grammars, not so much.
14 changes: 7 additions & 7 deletions doc/go-target.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ golang.org/x/exp
```

A complete list of releases can be found on [the release page](https://github.com/antlr/antlr4/releases). The Go
runtime will be tagged using standard Go tags, so release 4.12.1 in the `antlr4-go/antlr` repo, will be tagged with
`v4.12.1` and go get will pick that up from the ANTLR repo.
runtime will be tagged using standard Go tags, so release 4.13.0 in the `antlr4-go/antlr` repo, will be tagged with
`v4.13.0` and go get will pick that up from the ANTLR repo.

#### 3. Configuring `go generate` in your project

Expand All @@ -108,7 +108,7 @@ place the ANTLR grammar files in their own package in your project structure. He
├── myproject
├── parser
│ ├── mygrammar.g4
│ ├── antlr-4.12.1-complete.jar
│ ├── antlr-4.13.0-complete.jar
│ ├── generate.go
│ └── generate.sh
├── parsing # Generated code goes here
Expand All @@ -133,7 +133,7 @@ And the `generate.sh` file will look similar to this:
```shell
#!/bin/sh

alias antlr4='java -Xmx500M -cp "./antlr-4.12.1-complete.jar:$CLASSPATH" org.antlr.v4.Tool'
alias antlr4='java -Xmx500M -cp "./antlr-4.13.0-complete.jar:$CLASSPATH" org.antlr.v4.Tool'
antlr4 -Dlanguage=Go -no-visitor -package parsing *.g4
```

Expand Down Expand Up @@ -172,10 +172,10 @@ So the command `go get github.com/antlr/antlr4/runtime/Go/antlr` would just brin
whatever was the `HEAD` of the master branch. While this *kind of* worked, it is obviously subject to problems and does
not fit properly with the idiomatic ways of Go.

As of v4.12.1 the runtime code exists in its own repo, `github.com/antlr4-go/antlr`, and is correctly tagged.
As of v4.13.0 the runtime code exists in its own repo, `github.com/antlr4-go/antlr`, and is correctly tagged.
However, this means you need to perform a few simple actions in order to upgrade to the `/v4` path.

- Firstly, make sure that you are using an ANTLR tool jar with a version number of 4.12.1 or greater.
- Firstly, make sure that you are using an ANTLR tool jar with a version number of 4.13.0 or greater.
- Next you replace any mention of the old (default) path to ANTLR in your go source files.
- If using modules, remove any existing reference to the ANTLR Go runtime
- Now regenerate your grammar files either manually or using `go generate ./...` (see above)
Expand All @@ -197,7 +197,7 @@ go mod tidy
Should fix up your `go.mod` file to reference only the `v4` version of the ANTLR Go runtime:

```shell
require github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.12.1
require github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.13.0
```

From this point on, your go mod commands will work correctly with the ANTLR repo and upgrades and downgrades will work
Expand Down
Loading

0 comments on commit c630cb6

Please sign in to comment.