You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As part of my master thesis, I am planning to make some (minor) alterations and additions to the MLang syntax with two goals:
Add support for product extension
Make the distinction of a syntax or semantic extension vs. a base declaration clearer
We have been using the term Product Extension as a catch-all term for functionality in which we are able to add new fields to existing constructors. Our canonical examples are adding a ty or info field to an existing language. I have been using the term fine-grained product extension to talk about the ability of specifying the fields to add for a single, specific constructor and the term coarse-grained product extension to describe adding fields to all constructors of a syntax. I also suggest introducing a nominal aspect into the product extension syntax by giving each product extension a name. The most important reason for this is that this name can be used in an eventual type system extension to more concisely represent types.
The following program demonstrates my proposed syntax.
lang A =
-- Syntax declaration
syn S =
-- Semantic declaration
sem f =
ed
lang B = A
-- Sum Extension
-- We add two constructors 'Foo' and 'Bar' to S
syn S +=
| Foo {}
| Bar {x: Int}
-- Semantic extension
-- We add two additional cases to 'f'
sem f +=
| Foo _ -> 10
| Bar {x = x} -> x
end
lang C = A + B
-- Product Extension
-- We add a field 'y' to each constructor in S
-- And add a field 'z' to Foo specifically
syn S as MyProdExt *= {y : Int}
| Foo with {z : String}
end
The text was updated successfully, but these errors were encountered:
As part of my master thesis, I am planning to make some (minor) alterations and additions to the MLang syntax with two goals:
We have been using the term Product Extension as a catch-all term for functionality in which we are able to add new fields to existing constructors. Our canonical examples are adding a
ty
orinfo
field to an existing language. I have been using the term fine-grained product extension to talk about the ability of specifying the fields to add for a single, specific constructor and the term coarse-grained product extension to describe adding fields to all constructors of a syntax. I also suggest introducing a nominal aspect into the product extension syntax by giving each product extension a name. The most important reason for this is that this name can be used in an eventual type system extension to more concisely represent types.The following program demonstrates my proposed syntax.
The text was updated successfully, but these errors were encountered: