charmoniumQ / antlr4-python-grun

Pure-Python replacement of `org.antlr.v4.gui.TestRig` (aka `grun`)
MIT License
5 stars 0 forks source link

Pure-Python replacement of the antlr <https://www.antlr.org/>__ test rig, org.antlr.v4.gui.TestRig (aka grun).

There are a few places this executable differs in the interest of better or more Pythonic design. For example,


Installation

.. code-block:: bash

$ pip install https://github.com/charmoniumQ/antlr4-python-grun/archive/main.tar.gz

Usage

.. code-block:: bash

$ pygrun parse --help
Usage: pygrun parse [OPTIONS] GRAMMAR INITIAL_RULE [INPUT]

  Print parse of input as tree.

Arguments:
  GRAMMAR       [required]
  INITIAL_RULE  Initial rule to start parsing from  [required]
  [INPUT]       [default: /dev/stdin]

Options:
   / --ugly               [default: True]
  --format [s-expr|json]  [default: FormatType.s_expr]
  --help                  Show this message and exit.

.. code-block:: bash

$ pygrun tokenize --helpUsage: pygrun tokenize [OPTIONS] GRAMMAR [INPUT]

  Tokenize the input.

Arguments:
  GRAMMAR  [required]
  [INPUT]  [default: /dev/stdin]

Options:
  --format [s-expr|json]  [default: FormatType.s_expr]
  --help                  Show this message and exit.