summaryrefslogtreecommitdiff
path: root/examples/jem-math/MathIta.gf
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2008-09-15 15:28:47 +0000
committeraarne <aarne@cs.chalmers.se>2008-09-15 15:28:47 +0000
commite112fd188f905d90b727101fdbfa21478f4c9d18 (patch)
treed149a7c013a3720d49cfaa028cc317b8f0ce186f /examples/jem-math/MathIta.gf
parent117b38e47ff2c98402b975ada3240b5d4e996d86 (diff)
JEM tutorial examples - some files missing still
Diffstat (limited to 'examples/jem-math/MathIta.gf')
-rw-r--r--examples/jem-math/MathIta.gf40
1 files changed, 40 insertions, 0 deletions
diff --git a/examples/jem-math/MathIta.gf b/examples/jem-math/MathIta.gf
new file mode 100644
index 000000000..a4e406fe3
--- /dev/null
+++ b/examples/jem-math/MathIta.gf
@@ -0,0 +1,40 @@
+concrete MathIta of Math = {
+
+lincat
+ Prop, Exp = Str ;
+
+lin
+ And a b = a ++ "e" ++ b ;
+ Or a b = a ++ "o" ++ b ;
+ If a b = "si" ++ a ++ "allora" ++ b ;
+
+ Zero = "zero" ;
+
+ Successor x = "il successore di" ++ x ;
+
+ Sum x y = "la somma di" ++ x ++ "e" ++ y ;
+ Product x y = "il prodotto di" ++ x ++ "e" ++ y ;
+
+ Even x = x ++ "è pari" ;
+ Odd x = x ++ "è dispari" ;
+ Prime x = x ++ "è primo" ;
+
+ Equal x y = x ++ "è uguale a" ++ y ;
+ Less x y = x ++ "è inferiore a" ++ y ;
+ Greater x y = x ++ "è superiore a" ++ y ;
+ Divisible x y = x ++ "è divisibile per" ++ y ;
+
+lincat
+ Var = Str ;
+lin
+ X = "x" ;
+ Y = "y" ;
+
+ EVar x = x ;
+ EInt i = i.s ;
+
+ ANumberVar x = "un numero" ++ x ;
+ TheNumberVar x = "il numero" ++ x ;
+
+
+}