Skip to content

Commit 0b69aea

Browse files
committed
CI: Use TLAUC --skip numsets instead of unicode_number_set_shim.py
Use feature introduced in tlaplus-community/tlauc#23 Before these changes, the unicode_number_set_shim.py script was needed to rewrite all specs so they would import a shim version of the Naturals, Integers, and Reals standard modules that defined the ℕ, ℤ, and ℝ number sets. This was a very involved and brittle process, although it did showcase the power of the tree-sitter grammar queries. Now we can simply skip translating those number sets until tlaplus/tlaplus#1020 is fixed. Thus there is no need for the shim script. Signed-off-by: Andrew Helwer <ahelwer@pm.me>
1 parent a61fab6 commit 0b69aea

4 files changed

Lines changed: 2 additions & 159 deletions

File tree

.github/scripts/unicode_conversion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
def convert_module(module_path):
4646
logging.info(f'Converting {module_path}')
4747
result = subprocess.run(
48-
[tlauc_path, module_path] + (['--ascii'] if to_ascii else []),
48+
[tlauc_path, module_path, '--skip', 'numsets'] + (['--ascii'] if to_ascii else []),
4949
stdout=subprocess.PIPE,
5050
stderr=subprocess.STDOUT,
5151
text=True

.github/scripts/unicode_number_set_shim.py

Lines changed: 0 additions & 145 deletions
This file was deleted.

.github/workflows/CI.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,6 @@ jobs:
6767
python "$SCRIPT_DIR/unicode_conversion.py" \
6868
--tlauc_path "$DEPS_DIR/tlauc/tlauc" \
6969
--examples_root .
70-
- name: Add unicode shims
71-
if: matrix.unicode
72-
run: |
73-
python "$SCRIPT_DIR/unicode_number_set_shim.py" \
74-
--examples_root .
7570
- name: Translate PlusCal
7671
# PlusCal translations will be reverted at the end of this step,
7772
# since we want to support people manually editing the generated TLA+

DEVELOPING.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ Here is a brief overview of each script in the order they are run in [the CI](.g
1515
1. [`check_markdown_table.py`](.github/scripts/check_markdown_table.py): this uses the [mistletoe](https://pypi.org/project/mistletoe/) markdown parser python package to parse [`README.md`](README.md), extract the spec table, then validate its format & contents against each `manifest.json`; before this script was developed the table tended to diverge wildly from the actual content of this repo.
1616
1. [`unicode_conversion.py`](.github/scripts/unicode_conversion.py): this script uses [tlauc](https://github.com/tlaplus-community/tlauc) to convert each spec into its Unicode form to ensure TLA⁺ tooling functions identically on ASCII & Unicode specs.
1717
The CI spawns separate runs with and without conversion of specs to Unicode.
18-
1. [`unicode_number_set_shim.py`](.github/scripts/unicode_number_set_shim.py): since Unicode adoption is not yet fully ratified, Unicode definitions like ``, ``, and `` (as synonyms for `Nat`, `Int`, and `Real` respectively) are not yet included in the standard modules.
19-
This script works around that by using the [tree-sitter-tlaplus](https://pypi.org/project/tree-sitter-tlaplus/) python package to rewrite all imports of the `Naturals`, `Integers`, and `Reals` modules to import shim modules instead that define ``, ``, and ``.
20-
Once TLA⁺ fully adopts Unicode this (quite hackish) script will no longer be necessary.
2118
1. [`translate_pluscal.py`](.github/scripts/translate_pluscal.py): this script runs the PlusCal translator on all modules containing PlusCal, to ensure their PlusCal syntax is valid.
2219
1. [`parse_modules.py`](.github/scripts/parse_modules.py): this script runs the SANY parser against all `.tla` files in the repository to ensure they are syntactically & semantically valid.
2320
This can get quite complicated as many modules import specs defined in Apalache, TLAPM, or the community modules.
@@ -69,14 +66,10 @@ python .github/scripts/check_manifest_features.py --examples_root .
6966
```sh
7067
python .github/scripts/check_markdown_table.py --readme_path README.md
7168
```
72-
**WARNING:** the `unicode_conversion.py`, `unicode_number_set_shim.py`, and `translate_pluscal.py` scripts make large numbers of changes to files in your local repository, so be sure to run them on a clean branch where your own changes can't be clobbered and you can easily revert with `git reset --hard HEAD`.
69+
**WARNING:** the `unicode_conversion.py` and `translate_pluscal.py` scripts make large numbers of changes to files in your local repository, so be sure to run them on a clean branch where your own changes can't be clobbered and you can easily revert with `git reset --hard HEAD`.
7370
```sh
7471
python .github/scripts/unicode_conversion.py --tlauc_path deps/tlauc/tlauc --examples_root .
7572
```
76-
Delete all the shim files generated by `unicode_number_set_shim.py` with `find . -iname "*_UnicodeShim.tla" -delete`.
77-
```sh
78-
python .github/scripts/unicode_number_set_shim.py --examples_root .
79-
```
8073
```sh
8174
python .github/scripts/translate_pluscal.py --tools_jar_path deps/tools/tla2tools.jar --examples_root .
8275
```

0 commit comments

Comments
 (0)