Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull in updated version of SANY to support Unicode specs #2995

Open
ahelwer opened this issue Sep 19, 2024 · 5 comments
Open

Pull in updated version of SANY to support Unicode specs #2995

ahelwer opened this issue Sep 19, 2024 · 5 comments
Assignees
Labels
feature A new feature or functionality

Comments

@ahelwer
Copy link

ahelwer commented Sep 19, 2024

Now that SANY supports parsing Unicode TLA+ specs, it should be fairly straightforward to support Unicode here by updating to a newer version of SANY. Possible bugs include if your translation code looks at actual string representation (for example, "\\E" instead of TLAplusParserConstants.EXISTS) which was the case in SANY itself.

@ahelwer ahelwer added the feature A new feature or functionality label Sep 19, 2024
@konnov konnov self-assigned this Sep 20, 2024
@konnov
Copy link
Collaborator

konnov commented Sep 23, 2024

Possible bugs include if your translation code looks at actual string representation (for example, "\\E" instead of TLAplusParserConstants.EXISTS) which was the case in SANY itself.

Oh, we have a bunch of those :)

val simpleOpcodeToTlaOper: Map[String, TlaOper] = Map(
("=", TlaOper.eq),
("/=", TlaOper.ne),
("'", TlaActionOper.prime),
("\\lnot", TlaBoolOper.not),
("\\lor", TlaBoolOper.or),
("\\land", TlaBoolOper.and),
("\\equiv", TlaBoolOper.equiv),
("=>", TlaBoolOper.implies),
("SUBSET", TlaSetOper.powerset),
("UNION", TlaSetOper.union),
("DOMAIN", TlaFunOper.domain),
("\\subseteq", TlaSetOper.subseteq),
("\\in", TlaSetOper.in),
("\\notin", TlaSetOper.notin),
("\\", TlaSetOper.setminus),
("\\intersect", TlaSetOper.cap),
("\\union", TlaSetOper.cup),
("$CartesianProd", TlaSetOper.times),
("~>", TlaTempOper.leadsTo),
("[]", TlaTempOper.box),
("<>", TlaTempOper.diamond),
("ENABLED", TlaActionOper.enabled),
("UNCHANGED", TlaActionOper.unchanged),
("\\cdot", TlaActionOper.composition),
("-+->", TlaTempOper.guarantees),
("$AngleAct", TlaActionOper.nostutter),
("$SquareAct", TlaActionOper.stutter),
("$Tuple", TlaFunOper.tuple),
("$Pair", TlaFunOper.tuple),
("$ConjList", TlaBoolOper.and),
("$DisjList", TlaBoolOper.or),
("$Seq", TlaFunOper.tuple),
("$FcnApply", TlaFunOper.app),
("$IfThenElse", TlaControlOper.ifThenElse),
("$RcdSelect", TlaFunOper.app),
("$SetEnumerate", TlaSetOper.enumSet),
("$SetOfFcns", TlaSetOper.funSet),
("$SF", TlaTempOper.strongFairness),
("$WF", TlaTempOper.weakFairness),
)

@konnov
Copy link
Collaborator

konnov commented Sep 23, 2024

instead of TLAplusParserConstants.EXISTS

Do you know how stable this table of constants going to be? It's autogenerated. I assume that the names will not change most likely?

@konnov
Copy link
Collaborator

konnov commented Sep 23, 2024

@ahelwer do I understand it right that the unicode operators have their own names such as op_infix_neq_uc? I wonder where to get the actual mapping from without guessing.

@ahelwer
Copy link
Author

ahelwer commented Sep 23, 2024

Do you know how stable this table of constants going to be? It's autogenerated. I assume that the names will not change most likely?

It has been stable for about 10 years as far as I know, no plans to change it in the future.

do I understand it right that the unicode operators have their own names such as op_infix_neq_uc

No, they do not. They are all wrapped up into the same TLAplusParserConstants token IDs.

@ahelwer
Copy link
Author

ahelwer commented Sep 23, 2024

If you want a quick shortcut you could also just add all the different text-based unicode variants, defined here: https://github.com/tlaplus/tlaplus-standard/blob/main/unicode/tla-unicode.csv

Although this might make it more work if any of these mappings are ever changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature or functionality
Projects
None yet
Development

No branches or pull requests

2 participants