-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Another issue along with #18 intended as a good warmup for the Specification Language Committee (SLC) process. Currently, the TLA+ language standard allows users to write decimal literals without a leading zero, like ".1234"; see: https://github.com/tlaplus/tlaplus-standard/blob/652a8eb5d5838b9712be3502cb36dbae826d5689/grammar/TLAPlus2Grammar.tla#L38
However, neither SANY nor TLAPM actually support this; see:
- SANY differs from TLA+ language spec for parsing number values with decimals tlaplus#596
- TLAPM fails to parse decimal numbers of form
.12345without leading zero tlapm#173
Currently, only the tree-sitter grammar supports this functionality. Given that "Section 16.1.11: Numbers" on page 308 of Specifying Systems makes no mention of this curious syntax (every other programming language I can think of requires a leading zero for decimal literals), it is entirely likely that this is a typo in the formal TLA+ grammar and the regex was meant to be Numeral+ & {"."} & Numeral+ instead of Numeral* & {"."} & Numeral+.
However, we needn't waste time speculating - we can decide the truth for ourselves! This RFC proposes to define decimal literals as requiring a leading zero. The work required to ratify this RFC is fairly minor:
- Update the formal TLA+ grammar document in the tlaplus-standard repo
- Update the tree-sitter grammar to disallow this syntax
- Add a regression test to the
old_syntax.txtsyntax corpus document to ensure all conformant TLA+ parsers reject decimal literals lacking a leading zero - Write a short document outlining this change to be placed somewhere for the record, probably a directory in the tlaplus-standard repo