Skip to main content

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. Each node has line and column information for its start and end.

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, or the class tla._utils.Traversal.

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.

Metadata

Release files for tla 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tla 0.0.4
File Size Uploaded Provenance Actions
tla-0.0.4.tar.gz 149.6 kB Without provenance Details for tla-0.0.4.tar.gz

Release files / tla-0.0.4.tar.gz

Download URL tla-0.0.4.tar.gz
Size 149.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2b5bcf29060558c9cc31df05b905bb29e061136f1b6e6334f9d9f920f3c67adc
BLAKE2b-256 checksum
How to use checksums
b23363e9df85813569824ab65ae610032137485a630a8cfa996011909fae0632
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2+

Security for tla 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.4 This release

1 release file No provenance

0.0.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page