new tag syntax; preparing for Core patterns

new tag syntax; preparing for data names
This commit is contained in:
crumbtoo
2024-01-24 11:30:34 -07:00
parent d52a366c1b
commit 170e4e36ae
8 changed files with 42 additions and 22 deletions

View File

@@ -147,8 +147,8 @@ simple1 = [coreProg|
caseBool1 :: Program'
caseBool1 = [coreProg|
_if c x y = case c of
{ 1 -> x
; 0 -> y
{ <1> -> x
; <0> -> y
};
false = Pack{0 0};
@@ -160,8 +160,8 @@ caseBool1 = [coreProg|
fac3 :: Program'
fac3 = [coreProg|
fac n = case (==#) n 0 of
{ 1 -> 1
; 0 -> (*#) n (fac ((-#) n 1))
{ <1> -> 1
; <0> -> (*#) n (fac ((-#) n 1))
};
main = fac 3;
@@ -175,8 +175,8 @@ sumList = [coreProg|
cons x y = Pack{1 2} x y;
list = cons 1 (cons 2 (cons 3 nil));
sum l = case l of
{ 0 -> 0
; 1 x xs -> (+#) x (sum xs)
{ <0> -> 0
; <1> x xs -> (+#) x (sum xs)
};
main = sum list;
|]
@@ -192,7 +192,7 @@ idCase = [coreProg|
id x = x;
main = id (case Pack{1 0} of
{ 1 -> (+#) 2 3
{ <1> -> (+#) 2 3
})
|]