1
0
forked from GitHub/gf-core

Add support for literals

This commit is contained in:
John J. Camilleri
2021-03-22 09:12:34 +01:00
parent 2d066853f1
commit f7df62a445
6 changed files with 28 additions and 5 deletions

View File

@@ -4,4 +4,6 @@ abstract Literals = {
mkString : String -> S ;
mkInt : Int -> S ;
mkFloat : Float -> S ;
and : S -> S -> S ;
}

View File

@@ -1,5 +1,5 @@
Literals: mkString "hello"
LiteralsCnc: hello
LiteralsCnc: « hello »
Literals: mkInt 123
LiteralsCnc: 123
@@ -7,3 +7,6 @@ LiteralsCnc: 123
Literals: mkFloat 30.809000
LiteralsCnc: 30.809000
Literals: and (mkString "one") (mkString "two")
LiteralsCnc: « one » and « two »

View File

@@ -1,3 +1,4 @@
mkString "hello"
mkInt 123
mkFloat 30.809
and (mkString "one") (mkString "two")

View File

@@ -1,7 +1,9 @@
concrete LiteralsCnc of Literals = open Prelude in {
lincat S = SS ;
lin
mkString s = s ;
mkString s = ss ("«" ++ s.s ++ "»") ;
mkInt s = s ;
mkFloat s = s ;
and s1 s2 = ss (s1.s ++ "and" ++ s2.s) ;
}