Closed mariaKt closed 2 months ago
Thank you. I agree, I went ahead and removed approach 2, and it can be added back if needed. I also added a description of the new group tag in the parser documentation. Since you are OK with it, let's merge this now, so the new path is tested as part of CI and is not broken unintentionally. Once other rules exist that exercise this path, the TestSort2 rule and test directory will be entirely useless and should be removed.
This PR adds a way to handle K lists The function
_parse_mir_klist_json
is able to create a K list of elements of Sort sort, out of the provided json.There needs to be a way to identify the element sort though. I have provided two alternatives.
We can then use the new group identifier
mir-klist
to identify a klist, followed by-
and the element sort, as shown. Then, the information is tokenized and passed to_parse_mir_klist_json
.I have made changes to allow for calling the new function
_parse_mir_klist_json
directly in_parse_mir_nonterminal_json
, where the information about the processed production (thus the expected argument sorts) will be known. I have added a function intended to add any hardcoded information necessary (production symbols, argument positions, etc) that will be mapped to sorts.Both paths have been tested to work, albeit with two random Sorts
TestSort1
andTestSort2
(found in ty.k) that I only added for that reason. Please keep in mind that when the List sort is properly used as part of the semantics, these can be removed.