How to define/refer to list of variables
How can I simultaneously define/refer to multiple variables:
Sort : List(ID) -> Def Constructor : ID * List(ID) * ID -> Def Sorts(ss*): defines Sort ss* Constructor(name,args*,res): defines Constructor name refers to Sort args* refers to Sort res
Here,
Sort
andConstructor
contain lists of strings, for example,Sort(["Var", "Exp", "Stm"]) Constructor("app", ["Exp", "Exp"], "Exp")
Note that I don’t want to change the signatures of
Asked by Sebastian Erdweg on 7 May 2014 at 09:55Sort
andConstructor
(if possible) because that invalidates my existing transformations.
1 Answer
This is not possible. We typically prefer constructors around single names, for example,
Sort([SortDef("Var"), SortDef("Exp"), SortDef("Stm")]) Constructor("app", [SortRef("Exp"), SortRef("Exp")], SortRef("Exp"))
This is typically also helpful in typing and transformation rules. In your existing transformation rules, this should require only slight modifications of matching and building patterns.
Answered by Guido Wachsmuth on 7 May 2014 at 10:49