summaryrefslogtreecommitdiff
path: root/examples/numerals/swedish.gf
diff options
context:
space:
mode:
authoraarne <unknown>2004-01-29 12:57:32 +0000
committeraarne <unknown>2004-01-29 12:57:32 +0000
commitd09777a9aaeb580d8e793ad5e572296eb4c351d9 (patch)
tree8e6d54d1687bdc772cd67d91d643f246ce023776 /examples/numerals/swedish.gf
parentfdddeca0d08ba68b564b14359ef9b4a697cdb636 (diff)
New order among numerals.
Diffstat (limited to 'examples/numerals/swedish.gf')
-rw-r--r--examples/numerals/swedish.gf44
1 files changed, 44 insertions, 0 deletions
diff --git a/examples/numerals/swedish.gf b/examples/numerals/swedish.gf
new file mode 100644
index 000000000..41de7ab14
--- /dev/null
+++ b/examples/numerals/swedish.gf
@@ -0,0 +1,44 @@
+include numerals.Abs.gf ;
+
+param DForm = ental | ton | tiotal ;
+
+lincat
+ Digit = {s : DForm => Str} ;
+ Sub10 = {s : DForm => Str} ;
+
+oper
+ mkTal : Str -> Str -> Str -> Lin Digit = \två, tolv, tjugo ->
+ {s = table {ental => två ; ton => tolv ; tiotal => tjugo}} ;
+
+ regTal : Str -> Lin Digit = \fem ->
+ mkTal fem (fem + "ton") (fem + "tio") ;
+
+ ss : Str -> {s : Str} = \s -> {s = s} ;
+
+lin
+ num x = x ;
+
+ n2 = mkTal "två" "tolv" "tjugo" ;
+ n3 = mkTal "tre" "tretton" "trettio" ;
+ n4 = mkTal "fyra" "fjorton" "fyrtio" ;
+ n5 = regTal "fem" ;
+ n6 = regTal "sex" ;
+ n7 = mkTal "sju" "sjutton" "sjuttio" ;
+ n8 = mkTal "åtta" "arton" "åttio" ;
+ n9 = mkTal "nio" "nitton" "nittio" ;
+
+ pot01 = {s = table {f => "ett"}} ;
+ pot0 d = {s = table {f => d.s ! f}} ;
+ pot110 = ss "tio" ;
+ pot111 = ss "elva" ;
+ pot1to19 d = ss (d.s ! ton) ;
+ pot0as1 n = ss (n.s ! ental) ;
+ pot1 d = ss (d.s ! tiotal) ;
+ pot1plus d e = ss (d.s ! tiotal ++ e.s ! ental) ;
+ pot1as2 n = n ;
+ pot2 d = ss (d.s ! ental ++ "hundra") ;
+ pot2plus d e = ss (d.s ! ental ++ "hundra" ++ e.s) ;
+ pot2as3 n = n ;
+ pot3 n = ss (n.s ++ "tusen") ;
+ pot3plus n m = ss (n.s ++ "tusen" ++ m.s) ;
+