diff options
| author | aarne <aarne@cs.chalmers.se> | 2008-09-15 15:28:47 +0000 |
|---|---|---|
| committer | aarne <aarne@cs.chalmers.se> | 2008-09-15 15:28:47 +0000 |
| commit | e112fd188f905d90b727101fdbfa21478f4c9d18 (patch) | |
| tree | d149a7c013a3720d49cfaa028cc317b8f0ce186f /examples/jem-math/MathEng.gf | |
| parent | 117b38e47ff2c98402b975ada3240b5d4e996d86 (diff) | |
JEM tutorial examples - some files missing still
Diffstat (limited to 'examples/jem-math/MathEng.gf')
| -rw-r--r-- | examples/jem-math/MathEng.gf | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/examples/jem-math/MathEng.gf b/examples/jem-math/MathEng.gf new file mode 100644 index 000000000..ac29a504e --- /dev/null +++ b/examples/jem-math/MathEng.gf @@ -0,0 +1,42 @@ +concrete MathEng of Math = { + +lincat + Prop, Exp = Str ; + +lin + And a b = a ++ "and" ++ b ; + Or a b = a ++ "or" ++ b ; + If a b = "if" ++ a ++ "then" ++ b ; + + Zero = "zero" ; + + X = "x" ; + Y = "y" ; + + Successor x = "the successor of" ++ x ; + + Sum x y = "the sum of" ++ x ++ "and" ++ y ; + Product x y = "the product of" ++ x ++ "and" ++ y ; + + Even x = x ++ "is even" ; + Odd x = x ++ "is odd" ; + Prime x = x ++ "is prime" ; + + Equal x y = x ++ "is equal to" ++ y ; + Less x y = x ++ "is less than" ++ y ; + Greater x y = x ++ "is greater than" ++ y ; + Divisible x y = x ++ "is divisible by" ++ y ; + +lincat + Var = Str ; +lin + X = "x" ; + Y = "y" ; + + EVar x = x ; + EInt i = i.s ; + + ANumberVar x = "a number" ++ x ; + TheNumberVar x = "the number" ++ x ; + +} |
