Skip to main content

Parser and syntax tree for TLA+, the temporal logic of actions.

Project description

About

A parser for the Temporal Logic of Actions (TLA+). The parser is based on the LR(1) algorithm with state merging, and has time complexity linear in the size of the input. The lexer and parser are generated using parstools.

The syntax tree is represented as named-tuples, using typing.NamedTuple.

To install:

pip install tla

To parse a string:

import tla

module_text = r'''
    ---- MODULE name ----
    operator == TRUE
    ====================
    '''

tree = tla.parse(module_text)
print(tree)
text = tla.pformat_ast(tree)
print(text)

More examples can be found in the directory examples/. To implement a new translator of TLA+, as example the module tla._pprint can be used.

Documentation

In the Markdown file doc.md.

Tests

Use pytest. Run with:

cd tests/
pytest -v --continue-on-collection-errors .

Read also the file tests/README.md.

License

BSD-3, read LICENSE file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tla-0.0.2.tar.gz (128.1 kB view details)

Uploaded Source

File details

Details for the file tla-0.0.2.tar.gz.

File metadata

  • Download URL: tla-0.0.2.tar.gz
  • Upload date:
  • Size: 128.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.1+

File hashes

Hashes for tla-0.0.2.tar.gz
Algorithm Hash digest
SHA256 bc52a8898605dcf79eaf7857e1b675c723ad24319fdf8532bcbc7505bde3faf2
MD5 6b8a459f185cb192c9112f1e07e44f73
BLAKE2b-256 0b87161919cded3063e2fe85bf154eb645faff1cc465bba252f8b5fc77268fc1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page