Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .github/workflows/hosted.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ jobs:
javascript,
typescript,
php,
python2,
python3,
# swift,
]
Expand Down Expand Up @@ -233,13 +232,6 @@ jobs:
if: startswith(matrix.os, 'windows') && (matrix.target == 'cpp')
uses: microsoft/[email protected]

- name: Set up Python 2
if: matrix.target == 'python2'
uses: actions/setup-python@v4
with:
python-version: '2.x'
architecture: 'x64'

- name: Set up Python 3
if: matrix.target == 'python3'
uses: actions/setup-python@v4
Expand Down Expand Up @@ -316,7 +308,6 @@ jobs:
cd runtime-testsuite
switch ("${{ matrix.target }}")
{
python2 { mvn -X '-Dantlr-python2-exec="${{ env.pythonLocation }}\python.exe"' '-Dtest=python2.**' test }
python3 { mvn -X '-Dantlr-python3-exec="${{ env.pythonLocation }}\python.exe"' '-Dtest=python3.**' test }
default { mvn -X '-Dtest=${{ matrix.target }}.**' test }
}
Expand All @@ -331,7 +322,6 @@ jobs:

cd runtime-testsuite
case ${{ matrix.target }} in
python2) mvn -X '-Dantlr-python2-exec=${{ env.pythonLocation }}/bin/python' '-Dtest=python2.**' test ;;
python3) mvn -X '-Dantlr-python3-exec=${{ env.pythonLocation }}/bin/python' '-Dtest=python3.**' test ;;
*) mvn -X '-Dtest=${{ matrix.target }}.**' test ;;
esac
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ ANTLR project lead and supreme dictator for life
* [Official site](http://www.antlr.org/)
* [Documentation](https://github.com/antlr/antlr4/blob/master/doc/index.md)
* [FAQ](https://github.com/antlr/antlr4/blob/master/doc/faq/index.md)
* [ANTLR code generation targets](https://github.com/antlr/antlr4/blob/master/doc/targets.md)<br>(Currently: Java, C#, Python2|3, JavaScript, Go, C++, Swift, Dart, PHP)
* [ANTLR code generation targets](https://github.com/antlr/antlr4/blob/master/doc/targets.md)<br>(Currently: Java, C#, Python3, JavaScript, Go, C++, Swift, Dart, PHP)
* [Java API](http://www.antlr.org/api/Java/index.html)
* [ANTLR v3](http://www.antlr3.org/)
* [v3 to v4 Migration, differences](https://github.com/antlr/antlr4/blob/master/doc/faq/general.md)
Expand Down
2 changes: 1 addition & 1 deletion doc/IDEs.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Integrating ANTLR into Development Systems

The Java target is the reference implementation mirrored by other targets. The following pages help you integrate ANTLR into development environments and build systems appropriate for your target language. As of December 2016, we have Java, C#, Python 2, Python 3, JavaScript, Go, C++, and Swift targets.
The Java target is the reference implementation mirrored by other targets. The following pages help you integrate ANTLR into development environments and build systems appropriate for your target language. As of December 2016, we have Java, C#, Python 3, JavaScript, Go, C++, and Swift targets.

The easiest thing is probably just to use an [ANTLR plug-in](http://www.antlr.org/tools.html) for your favorite development environment.
1 change: 0 additions & 1 deletion doc/antlr-project-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ In order to perform the tests on all target languages, the following tools shoul

* dotnet
* Node.js
* Python 2
* Python 3
* Go
* Swift
Expand Down
11 changes: 2 additions & 9 deletions doc/python-target.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,11 @@

The examples from the ANTLR 4 book converted to Python are [here](https://github.com/jszheng/py3antlr4book).

There are 2 Python targets: `Python2` and `Python3`. This is because there is only limited compatibility between those 2 versions of the language. Please refer to the [Python documentation](https://wiki.python.org/moin/Python2orPython3) for full details.
There is ONE Python target: `Python3`. This is because there is only limited compatibility between those 2 versions of the language. Please refer to the [Python documentation](https://wiki.python.org/moin/Python3) for full details.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this can be rephrased a bit ?


How to create a Python lexer or parser?
This is pretty much the same as creating a Java lexer or parser, except you need to specify the language target, for example:

```
$ antlr4 -Dlanguage=Python2 MyGrammar.g4
```

or

```
$ antlr4 -Dlanguage=Python3 MyGrammar.g4
```
Expand All @@ -21,9 +15,8 @@ For a full list of antlr4 tool options, please visit the tool documentation page

## Where can I get the runtime?

Once you've generated the lexer and/or parser code, you need to download the runtime. The Python runtimes are available from PyPI:
Once you've generated the lexer and/or parser code, you need to download the runtime. The Python runtime are available from PyPI:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are -> is


* https://pypi.python.org/pypi/antlr4-python2-runtime/
* https://pypi.python.org/pypi/antlr4-python3-runtime/

The runtimes are provided in the form of source code, so no additional installation is required.
Expand Down
15 changes: 1 addition & 14 deletions doc/releasing-antlr.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@ java -cp ":/Users/parrt/.m2/repository/org/antlr/antlr4/4.13.0-SNAPSHOT/antlr4-4
cd ~/antlr/code/antlr4/runtime/CSharp/src/Tree/Xpath
java -cp ":/Users/parrt/.m2/repository/org/antlr/antlr4/4.13-0-SNAPSHOT/antlr4-4.13-0-SNAPSHOT-complete.jar:$CLASSPATH" org.antlr.v4.Tool -Dlanguage=CSharp XPathLexer.g4

cd ~/antlr/code/antlr4/runtime/Python2/src/antlr4/xpath
java -cp ":/Users/parrt/.m2/repository/org/antlr/antlr4/4.13-0-SNAPSHOT/antlr4-4.13-0-SNAPSHOT-complete.jar:$CLASSPATH" org.antlr.v4.Tool -Dlanguage=Python2 XPathLexer.g4

cd ~/antlr/code/antlr4/runtime/Python3/tests/expr
java -cp ":/Users/parrt/.m2/repository/org/antlr/antlr4/4.13-0-SNAPSHOT/antlr4-4.13-0-SNAPSHOT-complete.jar:$CLASSPATH" org.antlr.v4.Tool -Dlanguage=Python3 Expr.g4
cd ~/antlr/code/antlr4/runtime/Python3/src/antlr4/xpath
Expand Down Expand Up @@ -317,7 +314,7 @@ nuget push Antlr4.Runtime.Standard.<version>.nupkg <your-key> -Source https://ww

### Python

The Python targets get deployed with `twine` for Python 2 and 3.
The Python target gets deployed with `twine` for Python 3.

First, set up `~/.pypirc` with tight privileges:

Expand All @@ -343,16 +340,6 @@ password: xxx

Then run the python build and upload:

```bash
cd ~/antlr/code/antlr4/runtime/Python2
# assume you have ~/.pypirc set up
pip install build twine
python -m build
twine upload dist/antlr4-python2-runtime-4.13.0.tar.gz
```

For Python 3 target, do

```bash
cd ~/antlr/code/antlr4/runtime/Python3
python -m build
Expand Down
8 changes: 4 additions & 4 deletions doc/targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This page lists the available and upcoming ANTLR runtimes. Please note that you

* [Java](java-target.md). The [ANTLR v4 book](http://pragprog.com/book/tpantlr2/the-definitive-antlr-4-reference) has a decent summary of the runtime library. We have added a useful XPath feature since the book was printed that lets you select bits of parse trees. See [Runtime API](http://www.antlr.org/api/Java/index.html) and [Getting Started with ANTLR v4](getting-started.md)
* [C#](csharp-target.md)
* [Python](python-target.md) (2 and 3)
* [Python](python-target.md) (3)
* [JavaScript](javascript-target.md)
* [TypeScript](typescript-target.md)
* [Go](go-target.md)
Expand All @@ -17,7 +17,7 @@ This page lists the available and upcoming ANTLR runtimes. Please note that you

New features generally appear in the Java target and then migrate to the other targets, but these other targets don't always get updated in the same overall tool release. This section tries to identify features added to Java that have not been added to the other targets.

|Feature|Java|C&sharp;|Python2|Python3|JavaScript|Go|C++|Swift|PHP|Dart
|---|---|---|---|---|---|---|---|---|---|---|
|Ambiguous tree construction|4.5.1|-|-|-|-|-|-|-|-|-|
|Feature|Java|C&sharp;|Python3|JavaScript|Go|C++|Swift|PHP|Dart
|---|---|---|---|---|---|---|---|---|---|
|Ambiguous tree construction|4.5.1|-|-|-|-|-|-|-|-|

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<developer>
<name>Eric Vergnaud</name>
<roles>
<role>Developer - JavaScript, C#, Python 2, Python 3</role>
<role>Developer - JavaScript, C#, Python 3</role>
</roles>
</developer>
<developer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,4 @@ Go
JavaScript
TypeScript
PHP
Python2
Python3
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ between X1 and X2 or between X3 and X4
;

[skip]
Python2
Python3
JavaScript
TypeScript
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,4 @@ Go
JavaScript
TypeScript
PHP
Python2
Python3
Loading