Writing an Element program
Katherine Ye edited this page Jan 29, 2019
·
2 revisions
How does one model a domain? Roughly, the principle is that types are nouns, functions are verbs, and predicates are adjectives.
In order to define new syntax extension, you need to add a StmtNotation
in the dsll file. For example, a syntax extension for vectors additions might be
StmtNotation "v1 + v2" -> "AddV(v1,v2)"
Note that v1
and v2
are automatically recognized as patterns since they are not a special sign, they are not part of any DSLL definition, and they appear in both sides of the StmtNotation
.
In order to write a multi-line desugaring, you should use ;
for example:
StmtNotation "LinearMap f : U → V" -> "LinearMap f;From(f,U,V)"
Found a problem or got a suggestion? Please open a GitHub issue and tag it with documentation
!