aboutsummaryrefslogtreecommitdiff
path: root/example.txt
diff options
context:
space:
mode:
authorCamil Staps2023-02-01 21:22:23 +0100
committerCamil Staps2023-02-01 21:22:23 +0100
commit4ba55277a99542d245568da989b5217b04262f26 (patch)
treeba6b4ed2d1da9a1c46256fd58f126ef387512ed5 /example.txt
parentUse <<|> instead of <|> in parser to reduce memory usage (diff)
Remove ambiguity from function definition syntax: Type (x y) could have Type as kind *->*, or (x y) could be the rhs
Diffstat (limited to 'example.txt')
-rw-r--r--example.txt30
1 files changed, 15 insertions, 15 deletions
diff --git a/example.txt b/example.txt
index 26fc2d8..5aa858a 100644
--- a/example.txt
+++ b/example.txt
@@ -41,15 +41,15 @@
(DataDef TypeIdent (List TypeVarIdent) (List ConstructorDef))
(FunDef SymbolIdent (List (Tuple SymbolIdent Type)) Type Expression)))
-(fun list_ast () : Definition
- (DataDef
+(fun list_ast () : Definition :
+ DataDef
(Cons 'L' (Cons 'i' (Cons 's' (Cons 't' Nil))))
(Cons (Cons 'a' Nil) Nil)
(Cons (ConstructorDef (Cons 'N' (Cons 'i' (Cons 'l' Nil))) Nil)
(Cons (ConstructorDef (Cons 'C' (Cons 'o' (Cons 'n' (Cons 's' Nil)))) (Cons (TypeVar (Cons 'a' Nil)) (Cons (TypeApp (Type (Cons 'L' (Cons 'i' (Cons 's' (Cons 't' Nil))))) (TypeVar (Cons 'a' Nil))) Nil)))
- Nil))))
-(fun length_acc_ast () : Definition
- (FunDef
+ Nil)))
+(fun length_acc_ast () : Definition :
+ FunDef
(Cons 'l' (Cons 'e' (Cons 'n' (Cons 'g' (Cons 't' (Cons 'h' (Cons '_' (Cons 'a' (Cons 'c' (Cons 'c' Nil))))))))))
(Cons (Tuple (Cons 'n' Nil) (Type (Cons 'I' (Cons 'n' (Cons 't' Nil)))))
(Cons (Tuple (Cons 'x' (Cons 's' Nil)) (TypeApp (Type (Cons 'L' (Cons 'i' (Cons 's' (Cons 't' Nil))))) (TypeVar (Cons 'a' Nil))))
@@ -62,18 +62,18 @@
(Cons (CaseAlternative
(ConstructorPattern (Cons 'C' (Cons 'o' (Cons 'n' (Cons 's' Nil)))) (Cons Wildcard (Cons (IdentPattern (Cons 'x' (Cons 's' Nil))) Nil)))
(ExpApp (ExpApp (Symbol (Cons 'l' (Cons 'e' (Cons 'n' (Cons 'g' (Cons 't' (Cons 'h' (Cons '_' (Cons 'a' (Cons 'c' (Cons 'c' Nil))))))))))) (ExpApp (ExpApp (Cons '+' Nil) (Cons 'n' Nil)) (BasicValue (BVInt 1)))) (Cons 'x' (Cons 's' Nil))))
- Nil)))))
+ Nil))))
(#
-(fun length ((xs : List a)) : Int
- (length_acc 0 xs))
-(fun length_acc ((n : Int) (xs : List a)) : Int
- (case xs (
+(fun length ((xs : List a)) : Int :
+ length_acc 0 xs)
+(fun length_acc ((n : Int) (xs : List a)) : Int :
+ case xs (
(Nil -> n)
- (Cons _ xs -> length_acc (+ n 1) xs))))
+ (Cons _ xs -> length_acc (+ n 1) xs)))
#)
-(fun testb ((x : Int) (y : Int)) : Int
- (Tuple 37 'a'))
-(fun test () : Int
- (testb 37 42))
+(fun testb ((x : Int) (y : Int)) : Int :
+ Tuple 37 'a')
+(fun test () : Int :
+ testb 37 42)