You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/getting-started.md
+17-3Lines changed: 17 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ Hi and welcome to the version 4 release of ANTLR! See [Why do we need ANTLR v4?]
4
4
5
5
## Getting started the easy way using antlr4-tools
6
6
7
-
To play around with ANTLR without having to worry about installing it and the Java needed to execute it, use [antlr4-tools](https://github.com/antlr/antlr4-tools). The only requirement is Python3, which is typically installed on all developer machines on all operating systems.
7
+
To play around with ANTLR without having to worry about installing it and the Java needed to execute it, use [antlr4-tools](https://github.com/antlr/antlr4-tools). The only requirement is Python3, which is typically installed on all developer machines on all operating systems. (See below for Windows issue.)
8
8
9
9
```bash
10
10
$ pip install antlr4-tools
@@ -23,8 +23,6 @@ ANTLR Parser Generator Version 4.11.1
23
23
...
24
24
```
25
25
26
-
On Windows, the `pip` command doesn't just work---you need to add the `...\local-packages\python38\scripts` dir to your `PATH`, which itself might require a fun reboot. If you use WSL on Windows, then the pip install will also properly at the scripts directly (if you run from bash shell).
27
-
28
26
Let's play with a simple grammar:
29
27
30
28
```
@@ -39,6 +37,22 @@ NEWLINE : [\r\n]+ -> skip;
39
37
INT : [0-9]+ ;
40
38
```
41
39
40
+
### Windows-specific issues
41
+
42
+
On Windows, the `pip` command doesn't just work---you need to add the `...\local-packages\python38\scripts` dir to your `PATH`, which itself might require a fun reboot. If you use WSL on Windows, then the pip install will also properly at the scripts directly (if you run from bash shell).
43
+
44
+
45
+
1. Go to the Microsoft Store
46
+
2. Search in Microsoft Store for Python
47
+
3. Select the newest version of Python (3.10).
48
+
4. Click the "Get" button. Store installs python and pip at "c:\Users...\AppData\Local\Microsoft\WindowsApps\python.exe" and "c:\Users...\AppData\Local\Microsoft\WindowsApps\pip.exe", respectively. And, it updates the search path immediately with the install.
49
+
5. Open a "cmd" terminal.
50
+
6. You can now type "python" and "pip", and "pip install antlr4-tools". 7. Unfortunately, it does not add that to the search path.
51
+
7. Update the search path to contain `c:\Users...\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p8\LocalCache\local-packages\Python310\Scripts`. You may need to install MSYS2, then do a `find /c/ -name antlr4.exe 2> /dev/null` and enter that path.
52
+
8. Or, you can set up an alias to antlr4.exe on that path.
53
+
54
+
The good news is that the ANTLR4 Python tool downloads the ANTLR jar in a standard location, and you don't need to do that manually. It's also possible to go in a browser, go to python.org, and download the python package. But, it's likely you will need to update the path for antlr4.exe as before.
55
+
42
56
### Try parsing with a sample grammar
43
57
44
58
To parse and get the parse tree in text form, use:
0 commit comments