Skip to content

Proposal: standardize allowing multiple sequential modules in a file #17

@ahelwer

Description

@ahelwer

tlaplus/tlaplus#1104 made me realize that this hasn't gone through the standardization process, although it should. This would expand the TLA+ file standard to allow sequential module definitions, like:

freeform extramodular text

---- MODULE First ----
EXTENDS Second
op == TRUE
=======================

more freeform text

---- MODULE Second ----
EXTENDS Third
op2 == TRUE
=======================

even more freeform text

---- MODULE Third ----
op3 == TRUE
=======================

concluding freeform text

The tree-sitter-tlaplus parser already supports this, as you can see from the highlighting in the above snippet. SANY currently supports this by splitting the file using regexes in MonolithSpecExtractor. This could instead be formalized and moved into the syntax parser, to avoid the general nightmare of long-tail regex context issues. So the new root node of the SANY parse tree would be a list of modules interspersed with extramodular text, instead of a single module node.

This is useful when writing tests for TLA+ tooling and also when whipping up a quick spec where you want an encapsulated utility module without making it a nested module for some reason.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions