aboutsummaryrefslogtreecommitdiff
path: root/example.txt
diff options
context:
space:
mode:
Diffstat (limited to 'example.txt')
-rw-r--r--example.txt74
1 files changed, 37 insertions, 37 deletions
diff --git a/example.txt b/example.txt
index b83c606..b36c823 100644
--- a/example.txt
+++ b/example.txt
@@ -1,60 +1,60 @@
-(data (Tuple a b)
- (Tuple a b))
-(data (List a)
+(data Tuple (a b) (
+ (Tuple a b)))
+(data List (a) (
Nil
- (Cons a (List a)))
+ (Cons a (List a))))
(type String (List Char))
-(fun readline : (List Char)
- (case getc
- '\n' -> Nil
- c -> c : readline))
-
-(fun length (xs : (List a)) : Int
+(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))
+(fun length_acc ((n : Int) (xs : List a)) : Int
+ (case xs (
+ (Nil -> n)
+ (Cons _ xs -> length_acc (+ n 1) xs))))
+
+(data TypeIdent ((TI String)))
+(data TypeVarIdent ((TVI String)))
+(data ConstructorIdent ((CI String)))
+(data SymbolIdent ((SI String)))
-(data Type
- (Type String)
- (TypeVar String)
- (TypeApp Type Type))
+(data Type (
+ (Type TypeIdent)
+ (TypeVar TypeVarIdent)
+ (TypeApp Type Type)))
-(data ConstructorDef
- (ConstructorDef String (List Type)))
+(data ConstructorDef (
+ (ConstructorDef ConstructorIdent (List Type))))
-(data BasicValue
+(data BasicValue (
(BVInt Int)
- (BVChar Char))
+ (BVChar Char)))
-(data Pattern
- WildCard
+(data Pattern (
+ Wildcard
(BasicValuePattern BasicValue)
- (IdentPattern String)
- (ConstructorPattern String (List Pattern)))
+ (IdentPattern SymbolIdent)
+ (ConstructorPattern ConstructorIdent (List Pattern))))
-(data CaseAlternative
- (CaseAlternative Pattern Expression))
+(data CaseAlternative (
+ (CaseAlternative Pattern Expression)))
-(data Expression
- (Ident String)
+(data Expression (
+ (Ident SymbolIdent)
(Case Expression (List CaseAlternative))
- (ExpApp Expression Expression))
+ (ExpApp Expression Expression)))
-(data Definition
- (DataDef String (List String) (List ConstructorDef))
- (FunDef String (List (Tuple String Type)) Type Expression))
+(data Definition (
+ (DataDef TypeIdent (List TypeVarIdent) (List ConstructorDef))
+ (FunDef SymbolIdent (List (Tuple SymbolIdent Type)) Type Expression)))
-(fun list_ast : Definition
+(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
+(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)))))
@@ -62,5 +62,5 @@
Nil))
(Case (Ident (Cons 'x' (Cons 's' Nil)))
(Cons (CaseAlternative (ConstructorPattern (Cons 'N' (Cons 'i' (Cons 'l' Nil))) Nil) (Ident (Cons 'n' Nil)))
- (Cons (CaseAlternative (ConstructorPattern (Cons 'C' (Cons 'o' (Cons 'n' (Cons 's' Nil)))) (Cons WildCard (Cons (IdentPattern (Cons 'x' (Cons 's' Nil))) Nil))) ())
+ (Cons (CaseAlternative (ConstructorPattern (Cons 'C' (Cons 'o' (Cons 'n' (Cons 's' Nil)))) (Cons Wildcard (Cons (IdentPattern (Cons 'x' (Cons 's' Nil))) Nil))))
Nil)))))