What's the runtime, what are the libraries?

76 views
Skip to first unread message

Matti Viljamaa

unread,
Apr 23, 2017, 8:07:32 AM4/23/17
to antlr-discussion
I'm trying to install antlr4 and I'm confused about distuinguishing between the runtime and the libraries.

I installed antlr4-python2-runtime. However, in this page runtime as a .jar is given (http://www.antlr.org/download.html).
Are these both equivalent runtimes?

In the folder 'antlr4' that pip installed, I can merely find .py files. But no binaries that I could run from cmd.exe.

So is the antlr4-python2-runtime a runtime or is it a library?

Or do I need to use the .jar for doing:

https://github.com/jszheng/py3antlr4book#run-first-example

Thanks.

Mike Lischke

unread,
Apr 23, 2017, 8:59:44 AM4/23/17
to antlr-di...@googlegroups.com
Matti,

> I'm trying to install antlr4 and I'm confused about distuinguishing between the runtime and the libraries.

Where did you get the idea of "libraries" from? IIRC the docs/book never say "libraries" but always: the "tool" and the "runtime". The tool is the jar used to generate your parser and lexer files and the runtime is what contains the support code so that your parser + lexer can be compiled/run.

Mike
--
www.soft-gems.net

Matti Viljamaa

unread,
Apr 23, 2017, 9:07:08 AM4/23/17
to antlr-discussion
When you do:

pip install antlr4-python2-runtime

It downloads to site-packages something that looks like a Python library.
Since the antlr4 folder there contains only .pys and no binaries.

So I'm confused about whether that antlr4-folder under site-packages needs to be utilized manually at all or whether the antlr4-4.7-complete.jar utilizes those files, without the user having to use them manually.

Mike Lischke

unread,
Apr 23, 2017, 10:17:17 AM4/23/17
to antlr-di...@googlegroups.com
pip install antlr4-python2-runtime

It downloads to site-packages something that looks like a Python library.
Since the antlr4 folder there contains only .pys and no binaries.

It's like I said: pip installs the runtime your generated parsers will use.


So I'm confused about whether that antlr4-folder under site-packages needs to be utilized manually at all or whether the antlr4-4.7-complete.jar utilizes those files, without the user having to use them manually.

The jar is a Java package. How would it use python code? The jar is the tool for generating your files (something you trigger manually). It doesn't need the python runtime (instead it uses the Java runtime). Read also: https://github.com/antlr/antlr4/blob/master/doc/python-target.md for more details.


Eric Vergnaud

unread,
May 2, 2017, 9:50:15 AM5/2/17
to antlr-discussion
Matti,

you need the jar to produce your Python lexer and parser.
you need to runtime to execute them.

Eric
Reply all
Reply to author
Forward
0 new messages