mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
Added bind operators, do-notation, a cons operator and list sytnax.
This commit is contained in:
@@ -24,6 +24,8 @@ data LetDef_
|
||||
type LetDef = Tree LetDef_
|
||||
data Case_
|
||||
type Case = Tree Case_
|
||||
data Bind_
|
||||
type Bind = Tree Bind_
|
||||
data VarOrWild_
|
||||
type VarOrWild = Tree VarOrWild_
|
||||
data FieldType_
|
||||
@@ -53,9 +55,12 @@ data Tree :: * -> * where
|
||||
ELet :: [LetDef] -> Exp -> Tree Exp_
|
||||
ECase :: Exp -> [Case] -> Tree Exp_
|
||||
EIf :: Exp -> Exp -> Exp -> Tree Exp_
|
||||
EDo :: [Bind] -> Exp -> Tree Exp_
|
||||
EAbs :: VarOrWild -> Exp -> Tree Exp_
|
||||
EPi :: VarOrWild -> Exp -> Exp -> Tree Exp_
|
||||
EPiNoVar :: Exp -> Exp -> Tree Exp_
|
||||
EBind :: Exp -> Exp -> Tree Exp_
|
||||
EBindC :: Exp -> Exp -> Tree Exp_
|
||||
EOr :: Exp -> Exp -> Tree Exp_
|
||||
EAnd :: Exp -> Exp -> Tree Exp_
|
||||
EEq :: Exp -> Exp -> Tree Exp_
|
||||
@@ -64,6 +69,7 @@ data Tree :: * -> * where
|
||||
ELe :: Exp -> Exp -> Tree Exp_
|
||||
EGt :: Exp -> Exp -> Tree Exp_
|
||||
EGe :: Exp -> Exp -> Tree Exp_
|
||||
EListCons :: Exp -> Exp -> Tree Exp_
|
||||
EAdd :: Exp -> Exp -> Tree Exp_
|
||||
ESub :: Exp -> Exp -> Tree Exp_
|
||||
EMul :: Exp -> Exp -> Tree Exp_
|
||||
@@ -74,6 +80,7 @@ data Tree :: * -> * where
|
||||
EProj :: Exp -> Ident -> Tree Exp_
|
||||
ERecType :: [FieldType] -> Tree Exp_
|
||||
ERec :: [FieldValue] -> Tree Exp_
|
||||
EList :: [Exp] -> Tree Exp_
|
||||
EVar :: Ident -> Tree Exp_
|
||||
EType :: Tree Exp_
|
||||
EStr :: String -> Tree Exp_
|
||||
@@ -81,6 +88,8 @@ data Tree :: * -> * where
|
||||
EMeta :: Tree Exp_
|
||||
LetDef :: Ident -> Exp -> Exp -> Tree LetDef_
|
||||
Case :: Pattern -> Exp -> Tree Case_
|
||||
BindVar :: VarOrWild -> Exp -> Tree Bind_
|
||||
BindNoVar :: Exp -> Tree Bind_
|
||||
VVar :: Ident -> Tree VarOrWild_
|
||||
VWild :: Tree VarOrWild_
|
||||
FieldType :: Ident -> Exp -> Tree FieldType_
|
||||
@@ -116,9 +125,12 @@ composOpM f t = case t of
|
||||
ELet letdefs exp -> return ELet `ap` mapM f letdefs `ap` f exp
|
||||
ECase exp cases -> return ECase `ap` f exp `ap` mapM f cases
|
||||
EIf exp0 exp1 exp2 -> return EIf `ap` f exp0 `ap` f exp1 `ap` f exp2
|
||||
EDo binds exp -> return EDo `ap` mapM f binds `ap` f exp
|
||||
EAbs varorwild exp -> return EAbs `ap` f varorwild `ap` f exp
|
||||
EPi varorwild exp0 exp1 -> return EPi `ap` f varorwild `ap` f exp0 `ap` f exp1
|
||||
EPiNoVar exp0 exp1 -> return EPiNoVar `ap` f exp0 `ap` f exp1
|
||||
EBind exp0 exp1 -> return EBind `ap` f exp0 `ap` f exp1
|
||||
EBindC exp0 exp1 -> return EBindC `ap` f exp0 `ap` f exp1
|
||||
EOr exp0 exp1 -> return EOr `ap` f exp0 `ap` f exp1
|
||||
EAnd exp0 exp1 -> return EAnd `ap` f exp0 `ap` f exp1
|
||||
EEq exp0 exp1 -> return EEq `ap` f exp0 `ap` f exp1
|
||||
@@ -127,6 +139,7 @@ composOpM f t = case t of
|
||||
ELe exp0 exp1 -> return ELe `ap` f exp0 `ap` f exp1
|
||||
EGt exp0 exp1 -> return EGt `ap` f exp0 `ap` f exp1
|
||||
EGe exp0 exp1 -> return EGe `ap` f exp0 `ap` f exp1
|
||||
EListCons exp0 exp1 -> return EListCons `ap` f exp0 `ap` f exp1
|
||||
EAdd exp0 exp1 -> return EAdd `ap` f exp0 `ap` f exp1
|
||||
ESub exp0 exp1 -> return ESub `ap` f exp0 `ap` f exp1
|
||||
EMul exp0 exp1 -> return EMul `ap` f exp0 `ap` f exp1
|
||||
@@ -137,9 +150,12 @@ composOpM f t = case t of
|
||||
EProj exp i -> return EProj `ap` f exp `ap` f i
|
||||
ERecType fieldtypes -> return ERecType `ap` mapM f fieldtypes
|
||||
ERec fieldvalues -> return ERec `ap` mapM f fieldvalues
|
||||
EList exps -> return EList `ap` mapM f exps
|
||||
EVar i -> return EVar `ap` f i
|
||||
LetDef i exp0 exp1 -> return LetDef `ap` f i `ap` f exp0 `ap` f exp1
|
||||
Case pattern exp -> return Case `ap` f pattern `ap` f exp
|
||||
BindVar varorwild exp -> return BindVar `ap` f varorwild `ap` f exp
|
||||
BindNoVar exp -> return BindNoVar `ap` f exp
|
||||
VVar i -> return VVar `ap` f i
|
||||
FieldType i exp -> return FieldType `ap` f i `ap` f exp
|
||||
FieldValue i exp -> return FieldValue `ap` f i `ap` f exp
|
||||
@@ -162,9 +178,12 @@ composOpFold zero combine f t = case t of
|
||||
ELet letdefs exp -> foldr combine zero (map f letdefs) `combine` f exp
|
||||
ECase exp cases -> f exp `combine` foldr combine zero (map f cases)
|
||||
EIf exp0 exp1 exp2 -> f exp0 `combine` f exp1 `combine` f exp2
|
||||
EDo binds exp -> foldr combine zero (map f binds) `combine` f exp
|
||||
EAbs varorwild exp -> f varorwild `combine` f exp
|
||||
EPi varorwild exp0 exp1 -> f varorwild `combine` f exp0 `combine` f exp1
|
||||
EPiNoVar exp0 exp1 -> f exp0 `combine` f exp1
|
||||
EBind exp0 exp1 -> f exp0 `combine` f exp1
|
||||
EBindC exp0 exp1 -> f exp0 `combine` f exp1
|
||||
EOr exp0 exp1 -> f exp0 `combine` f exp1
|
||||
EAnd exp0 exp1 -> f exp0 `combine` f exp1
|
||||
EEq exp0 exp1 -> f exp0 `combine` f exp1
|
||||
@@ -173,6 +192,7 @@ composOpFold zero combine f t = case t of
|
||||
ELe exp0 exp1 -> f exp0 `combine` f exp1
|
||||
EGt exp0 exp1 -> f exp0 `combine` f exp1
|
||||
EGe exp0 exp1 -> f exp0 `combine` f exp1
|
||||
EListCons exp0 exp1 -> f exp0 `combine` f exp1
|
||||
EAdd exp0 exp1 -> f exp0 `combine` f exp1
|
||||
ESub exp0 exp1 -> f exp0 `combine` f exp1
|
||||
EMul exp0 exp1 -> f exp0 `combine` f exp1
|
||||
@@ -183,9 +203,12 @@ composOpFold zero combine f t = case t of
|
||||
EProj exp i -> f exp `combine` f i
|
||||
ERecType fieldtypes -> foldr combine zero (map f fieldtypes)
|
||||
ERec fieldvalues -> foldr combine zero (map f fieldvalues)
|
||||
EList exps -> foldr combine zero (map f exps)
|
||||
EVar i -> f i
|
||||
LetDef i exp0 exp1 -> f i `combine` f exp0 `combine` f exp1
|
||||
Case pattern exp -> f pattern `combine` f exp
|
||||
BindVar varorwild exp -> f varorwild `combine` f exp
|
||||
BindNoVar exp -> f exp
|
||||
VVar i -> f i
|
||||
FieldType i exp -> f i `combine` f exp
|
||||
FieldValue i exp -> f i `combine` f exp
|
||||
@@ -212,9 +235,12 @@ instance Show (Tree c) where
|
||||
ELet letdefs exp -> opar n . showString "ELet" . showChar ' ' . showsPrec 1 letdefs . showChar ' ' . showsPrec 1 exp . cpar n
|
||||
ECase exp cases -> opar n . showString "ECase" . showChar ' ' . showsPrec 1 exp . showChar ' ' . showsPrec 1 cases . cpar n
|
||||
EIf exp0 exp1 exp2 -> opar n . showString "EIf" . showChar ' ' . showsPrec 1 exp0 . showChar ' ' . showsPrec 1 exp1 . showChar ' ' . showsPrec 1 exp2 . cpar n
|
||||
EDo binds exp -> opar n . showString "EDo" . showChar ' ' . showsPrec 1 binds . showChar ' ' . showsPrec 1 exp . cpar n
|
||||
EAbs varorwild exp -> opar n . showString "EAbs" . showChar ' ' . showsPrec 1 varorwild . showChar ' ' . showsPrec 1 exp . cpar n
|
||||
EPi varorwild exp0 exp1 -> opar n . showString "EPi" . showChar ' ' . showsPrec 1 varorwild . showChar ' ' . showsPrec 1 exp0 . showChar ' ' . showsPrec 1 exp1 . cpar n
|
||||
EPiNoVar exp0 exp1 -> opar n . showString "EPiNoVar" . showChar ' ' . showsPrec 1 exp0 . showChar ' ' . showsPrec 1 exp1 . cpar n
|
||||
EBind exp0 exp1 -> opar n . showString "EBind" . showChar ' ' . showsPrec 1 exp0 . showChar ' ' . showsPrec 1 exp1 . cpar n
|
||||
EBindC exp0 exp1 -> opar n . showString "EBindC" . showChar ' ' . showsPrec 1 exp0 . showChar ' ' . showsPrec 1 exp1 . cpar n
|
||||
EOr exp0 exp1 -> opar n . showString "EOr" . showChar ' ' . showsPrec 1 exp0 . showChar ' ' . showsPrec 1 exp1 . cpar n
|
||||
EAnd exp0 exp1 -> opar n . showString "EAnd" . showChar ' ' . showsPrec 1 exp0 . showChar ' ' . showsPrec 1 exp1 . cpar n
|
||||
EEq exp0 exp1 -> opar n . showString "EEq" . showChar ' ' . showsPrec 1 exp0 . showChar ' ' . showsPrec 1 exp1 . cpar n
|
||||
@@ -223,6 +249,7 @@ instance Show (Tree c) where
|
||||
ELe exp0 exp1 -> opar n . showString "ELe" . showChar ' ' . showsPrec 1 exp0 . showChar ' ' . showsPrec 1 exp1 . cpar n
|
||||
EGt exp0 exp1 -> opar n . showString "EGt" . showChar ' ' . showsPrec 1 exp0 . showChar ' ' . showsPrec 1 exp1 . cpar n
|
||||
EGe exp0 exp1 -> opar n . showString "EGe" . showChar ' ' . showsPrec 1 exp0 . showChar ' ' . showsPrec 1 exp1 . cpar n
|
||||
EListCons exp0 exp1 -> opar n . showString "EListCons" . showChar ' ' . showsPrec 1 exp0 . showChar ' ' . showsPrec 1 exp1 . cpar n
|
||||
EAdd exp0 exp1 -> opar n . showString "EAdd" . showChar ' ' . showsPrec 1 exp0 . showChar ' ' . showsPrec 1 exp1 . cpar n
|
||||
ESub exp0 exp1 -> opar n . showString "ESub" . showChar ' ' . showsPrec 1 exp0 . showChar ' ' . showsPrec 1 exp1 . cpar n
|
||||
EMul exp0 exp1 -> opar n . showString "EMul" . showChar ' ' . showsPrec 1 exp0 . showChar ' ' . showsPrec 1 exp1 . cpar n
|
||||
@@ -233,6 +260,7 @@ instance Show (Tree c) where
|
||||
EProj exp i -> opar n . showString "EProj" . showChar ' ' . showsPrec 1 exp . showChar ' ' . showsPrec 1 i . cpar n
|
||||
ERecType fieldtypes -> opar n . showString "ERecType" . showChar ' ' . showsPrec 1 fieldtypes . cpar n
|
||||
ERec fieldvalues -> opar n . showString "ERec" . showChar ' ' . showsPrec 1 fieldvalues . cpar n
|
||||
EList exps -> opar n . showString "EList" . showChar ' ' . showsPrec 1 exps . cpar n
|
||||
EVar i -> opar n . showString "EVar" . showChar ' ' . showsPrec 1 i . cpar n
|
||||
EType -> showString "EType"
|
||||
EStr str -> opar n . showString "EStr" . showChar ' ' . showsPrec 1 str . cpar n
|
||||
@@ -240,6 +268,8 @@ instance Show (Tree c) where
|
||||
EMeta -> showString "EMeta"
|
||||
LetDef i exp0 exp1 -> opar n . showString "LetDef" . showChar ' ' . showsPrec 1 i . showChar ' ' . showsPrec 1 exp0 . showChar ' ' . showsPrec 1 exp1 . cpar n
|
||||
Case pattern exp -> opar n . showString "Case" . showChar ' ' . showsPrec 1 pattern . showChar ' ' . showsPrec 1 exp . cpar n
|
||||
BindVar varorwild exp -> opar n . showString "BindVar" . showChar ' ' . showsPrec 1 varorwild . showChar ' ' . showsPrec 1 exp . cpar n
|
||||
BindNoVar exp -> opar n . showString "BindNoVar" . showChar ' ' . showsPrec 1 exp . cpar n
|
||||
VVar i -> opar n . showString "VVar" . showChar ' ' . showsPrec 1 i . cpar n
|
||||
VWild -> showString "VWild"
|
||||
FieldType i exp -> opar n . showString "FieldType" . showChar ' ' . showsPrec 1 i . showChar ' ' . showsPrec 1 exp . cpar n
|
||||
@@ -270,9 +300,12 @@ johnMajorEq (FieldPattern i pattern) (FieldPattern i_ pattern_) = i == i_ && pat
|
||||
johnMajorEq (ELet letdefs exp) (ELet letdefs_ exp_) = letdefs == letdefs_ && exp == exp_
|
||||
johnMajorEq (ECase exp cases) (ECase exp_ cases_) = exp == exp_ && cases == cases_
|
||||
johnMajorEq (EIf exp0 exp1 exp2) (EIf exp0_ exp1_ exp2_) = exp0 == exp0_ && exp1 == exp1_ && exp2 == exp2_
|
||||
johnMajorEq (EDo binds exp) (EDo binds_ exp_) = binds == binds_ && exp == exp_
|
||||
johnMajorEq (EAbs varorwild exp) (EAbs varorwild_ exp_) = varorwild == varorwild_ && exp == exp_
|
||||
johnMajorEq (EPi varorwild exp0 exp1) (EPi varorwild_ exp0_ exp1_) = varorwild == varorwild_ && exp0 == exp0_ && exp1 == exp1_
|
||||
johnMajorEq (EPiNoVar exp0 exp1) (EPiNoVar exp0_ exp1_) = exp0 == exp0_ && exp1 == exp1_
|
||||
johnMajorEq (EBind exp0 exp1) (EBind exp0_ exp1_) = exp0 == exp0_ && exp1 == exp1_
|
||||
johnMajorEq (EBindC exp0 exp1) (EBindC exp0_ exp1_) = exp0 == exp0_ && exp1 == exp1_
|
||||
johnMajorEq (EOr exp0 exp1) (EOr exp0_ exp1_) = exp0 == exp0_ && exp1 == exp1_
|
||||
johnMajorEq (EAnd exp0 exp1) (EAnd exp0_ exp1_) = exp0 == exp0_ && exp1 == exp1_
|
||||
johnMajorEq (EEq exp0 exp1) (EEq exp0_ exp1_) = exp0 == exp0_ && exp1 == exp1_
|
||||
@@ -281,6 +314,7 @@ johnMajorEq (ELt exp0 exp1) (ELt exp0_ exp1_) = exp0 == exp0_ && exp1 == exp1_
|
||||
johnMajorEq (ELe exp0 exp1) (ELe exp0_ exp1_) = exp0 == exp0_ && exp1 == exp1_
|
||||
johnMajorEq (EGt exp0 exp1) (EGt exp0_ exp1_) = exp0 == exp0_ && exp1 == exp1_
|
||||
johnMajorEq (EGe exp0 exp1) (EGe exp0_ exp1_) = exp0 == exp0_ && exp1 == exp1_
|
||||
johnMajorEq (EListCons exp0 exp1) (EListCons exp0_ exp1_) = exp0 == exp0_ && exp1 == exp1_
|
||||
johnMajorEq (EAdd exp0 exp1) (EAdd exp0_ exp1_) = exp0 == exp0_ && exp1 == exp1_
|
||||
johnMajorEq (ESub exp0 exp1) (ESub exp0_ exp1_) = exp0 == exp0_ && exp1 == exp1_
|
||||
johnMajorEq (EMul exp0 exp1) (EMul exp0_ exp1_) = exp0 == exp0_ && exp1 == exp1_
|
||||
@@ -291,6 +325,7 @@ johnMajorEq (EApp exp0 exp1) (EApp exp0_ exp1_) = exp0 == exp0_ && exp1 == exp1_
|
||||
johnMajorEq (EProj exp i) (EProj exp_ i_) = exp == exp_ && i == i_
|
||||
johnMajorEq (ERecType fieldtypes) (ERecType fieldtypes_) = fieldtypes == fieldtypes_
|
||||
johnMajorEq (ERec fieldvalues) (ERec fieldvalues_) = fieldvalues == fieldvalues_
|
||||
johnMajorEq (EList exps) (EList exps_) = exps == exps_
|
||||
johnMajorEq (EVar i) (EVar i_) = i == i_
|
||||
johnMajorEq EType EType = True
|
||||
johnMajorEq (EStr str) (EStr str_) = str == str_
|
||||
@@ -298,6 +333,8 @@ johnMajorEq (EInt n) (EInt n_) = n == n_
|
||||
johnMajorEq EMeta EMeta = True
|
||||
johnMajorEq (LetDef i exp0 exp1) (LetDef i_ exp0_ exp1_) = i == i_ && exp0 == exp0_ && exp1 == exp1_
|
||||
johnMajorEq (Case pattern exp) (Case pattern_ exp_) = pattern == pattern_ && exp == exp_
|
||||
johnMajorEq (BindVar varorwild exp) (BindVar varorwild_ exp_) = varorwild == varorwild_ && exp == exp_
|
||||
johnMajorEq (BindNoVar exp) (BindNoVar exp_) = exp == exp_
|
||||
johnMajorEq (VVar i) (VVar i_) = i == i_
|
||||
johnMajorEq VWild VWild = True
|
||||
johnMajorEq (FieldType i exp) (FieldType i_ exp_) = i == i_ && exp == exp_
|
||||
@@ -327,39 +364,46 @@ instance Ord (Tree c) where
|
||||
index (ELet _ _) = 16
|
||||
index (ECase _ _) = 17
|
||||
index (EIf _ _ _) = 18
|
||||
index (EAbs _ _) = 19
|
||||
index (EPi _ _ _) = 20
|
||||
index (EPiNoVar _ _) = 21
|
||||
index (EOr _ _) = 22
|
||||
index (EAnd _ _) = 23
|
||||
index (EEq _ _) = 24
|
||||
index (ENe _ _) = 25
|
||||
index (ELt _ _) = 26
|
||||
index (ELe _ _) = 27
|
||||
index (EGt _ _) = 28
|
||||
index (EGe _ _) = 29
|
||||
index (EAdd _ _) = 30
|
||||
index (ESub _ _) = 31
|
||||
index (EMul _ _) = 32
|
||||
index (EDiv _ _) = 33
|
||||
index (EMod _ _) = 34
|
||||
index (ENeg _) = 35
|
||||
index (EApp _ _) = 36
|
||||
index (EProj _ _) = 37
|
||||
index (ERecType _) = 38
|
||||
index (ERec _) = 39
|
||||
index (EVar _) = 40
|
||||
index (EType ) = 41
|
||||
index (EStr _) = 42
|
||||
index (EInt _) = 43
|
||||
index (EMeta ) = 44
|
||||
index (LetDef _ _ _) = 45
|
||||
index (Case _ _) = 46
|
||||
index (VVar _) = 47
|
||||
index (VWild ) = 48
|
||||
index (FieldType _ _) = 49
|
||||
index (FieldValue _ _) = 50
|
||||
index (Ident _) = 51
|
||||
index (EDo _ _) = 19
|
||||
index (EAbs _ _) = 20
|
||||
index (EPi _ _ _) = 21
|
||||
index (EPiNoVar _ _) = 22
|
||||
index (EBind _ _) = 23
|
||||
index (EBindC _ _) = 24
|
||||
index (EOr _ _) = 25
|
||||
index (EAnd _ _) = 26
|
||||
index (EEq _ _) = 27
|
||||
index (ENe _ _) = 28
|
||||
index (ELt _ _) = 29
|
||||
index (ELe _ _) = 30
|
||||
index (EGt _ _) = 31
|
||||
index (EGe _ _) = 32
|
||||
index (EListCons _ _) = 33
|
||||
index (EAdd _ _) = 34
|
||||
index (ESub _ _) = 35
|
||||
index (EMul _ _) = 36
|
||||
index (EDiv _ _) = 37
|
||||
index (EMod _ _) = 38
|
||||
index (ENeg _) = 39
|
||||
index (EApp _ _) = 40
|
||||
index (EProj _ _) = 41
|
||||
index (ERecType _) = 42
|
||||
index (ERec _) = 43
|
||||
index (EList _) = 44
|
||||
index (EVar _) = 45
|
||||
index (EType ) = 46
|
||||
index (EStr _) = 47
|
||||
index (EInt _) = 48
|
||||
index (EMeta ) = 49
|
||||
index (LetDef _ _ _) = 50
|
||||
index (Case _ _) = 51
|
||||
index (BindVar _ _) = 52
|
||||
index (BindNoVar _) = 53
|
||||
index (VVar _) = 54
|
||||
index (VWild ) = 55
|
||||
index (FieldType _ _) = 56
|
||||
index (FieldValue _ _) = 57
|
||||
index (Ident _) = 58
|
||||
compareSame (Module imports decls) (Module imports_ decls_) = mappend (compare imports imports_) (compare decls decls_)
|
||||
compareSame (Import i) (Import i_) = compare i i_
|
||||
compareSame (DataDecl i exp consdecls) (DataDecl i_ exp_ consdecls_) = mappend (compare i i_) (mappend (compare exp exp_) (compare consdecls consdecls_))
|
||||
@@ -379,9 +423,12 @@ instance Ord (Tree c) where
|
||||
compareSame (ELet letdefs exp) (ELet letdefs_ exp_) = mappend (compare letdefs letdefs_) (compare exp exp_)
|
||||
compareSame (ECase exp cases) (ECase exp_ cases_) = mappend (compare exp exp_) (compare cases cases_)
|
||||
compareSame (EIf exp0 exp1 exp2) (EIf exp0_ exp1_ exp2_) = mappend (compare exp0 exp0_) (mappend (compare exp1 exp1_) (compare exp2 exp2_))
|
||||
compareSame (EDo binds exp) (EDo binds_ exp_) = mappend (compare binds binds_) (compare exp exp_)
|
||||
compareSame (EAbs varorwild exp) (EAbs varorwild_ exp_) = mappend (compare varorwild varorwild_) (compare exp exp_)
|
||||
compareSame (EPi varorwild exp0 exp1) (EPi varorwild_ exp0_ exp1_) = mappend (compare varorwild varorwild_) (mappend (compare exp0 exp0_) (compare exp1 exp1_))
|
||||
compareSame (EPiNoVar exp0 exp1) (EPiNoVar exp0_ exp1_) = mappend (compare exp0 exp0_) (compare exp1 exp1_)
|
||||
compareSame (EBind exp0 exp1) (EBind exp0_ exp1_) = mappend (compare exp0 exp0_) (compare exp1 exp1_)
|
||||
compareSame (EBindC exp0 exp1) (EBindC exp0_ exp1_) = mappend (compare exp0 exp0_) (compare exp1 exp1_)
|
||||
compareSame (EOr exp0 exp1) (EOr exp0_ exp1_) = mappend (compare exp0 exp0_) (compare exp1 exp1_)
|
||||
compareSame (EAnd exp0 exp1) (EAnd exp0_ exp1_) = mappend (compare exp0 exp0_) (compare exp1 exp1_)
|
||||
compareSame (EEq exp0 exp1) (EEq exp0_ exp1_) = mappend (compare exp0 exp0_) (compare exp1 exp1_)
|
||||
@@ -390,6 +437,7 @@ instance Ord (Tree c) where
|
||||
compareSame (ELe exp0 exp1) (ELe exp0_ exp1_) = mappend (compare exp0 exp0_) (compare exp1 exp1_)
|
||||
compareSame (EGt exp0 exp1) (EGt exp0_ exp1_) = mappend (compare exp0 exp0_) (compare exp1 exp1_)
|
||||
compareSame (EGe exp0 exp1) (EGe exp0_ exp1_) = mappend (compare exp0 exp0_) (compare exp1 exp1_)
|
||||
compareSame (EListCons exp0 exp1) (EListCons exp0_ exp1_) = mappend (compare exp0 exp0_) (compare exp1 exp1_)
|
||||
compareSame (EAdd exp0 exp1) (EAdd exp0_ exp1_) = mappend (compare exp0 exp0_) (compare exp1 exp1_)
|
||||
compareSame (ESub exp0 exp1) (ESub exp0_ exp1_) = mappend (compare exp0 exp0_) (compare exp1 exp1_)
|
||||
compareSame (EMul exp0 exp1) (EMul exp0_ exp1_) = mappend (compare exp0 exp0_) (compare exp1 exp1_)
|
||||
@@ -400,6 +448,7 @@ instance Ord (Tree c) where
|
||||
compareSame (EProj exp i) (EProj exp_ i_) = mappend (compare exp exp_) (compare i i_)
|
||||
compareSame (ERecType fieldtypes) (ERecType fieldtypes_) = compare fieldtypes fieldtypes_
|
||||
compareSame (ERec fieldvalues) (ERec fieldvalues_) = compare fieldvalues fieldvalues_
|
||||
compareSame (EList exps) (EList exps_) = compare exps exps_
|
||||
compareSame (EVar i) (EVar i_) = compare i i_
|
||||
compareSame EType EType = EQ
|
||||
compareSame (EStr str) (EStr str_) = compare str str_
|
||||
@@ -407,6 +456,8 @@ instance Ord (Tree c) where
|
||||
compareSame EMeta EMeta = EQ
|
||||
compareSame (LetDef i exp0 exp1) (LetDef i_ exp0_ exp1_) = mappend (compare i i_) (mappend (compare exp0 exp0_) (compare exp1 exp1_))
|
||||
compareSame (Case pattern exp) (Case pattern_ exp_) = mappend (compare pattern pattern_) (compare exp exp_)
|
||||
compareSame (BindVar varorwild exp) (BindVar varorwild_ exp_) = mappend (compare varorwild varorwild_) (compare exp exp_)
|
||||
compareSame (BindNoVar exp) (BindNoVar exp_) = compare exp exp_
|
||||
compareSame (VVar i) (VVar i_) = compare i i_
|
||||
compareSame VWild VWild = EQ
|
||||
compareSame (FieldType i exp) (FieldType i_ exp_) = mappend (compare i i_) (compare exp exp_)
|
||||
|
||||
@@ -46,10 +46,10 @@ The reserved words used in Syntax are the following: \\
|
||||
|
||||
\begin{tabular}{lll}
|
||||
{\reserved{Type}} &{\reserved{case}} &{\reserved{data}} \\
|
||||
{\reserved{derive}} &{\reserved{else}} &{\reserved{if}} \\
|
||||
{\reserved{import}} &{\reserved{in}} &{\reserved{let}} \\
|
||||
{\reserved{of}} &{\reserved{rec}} &{\reserved{sig}} \\
|
||||
{\reserved{then}} &{\reserved{where}} & \\
|
||||
{\reserved{derive}} &{\reserved{do}} &{\reserved{else}} \\
|
||||
{\reserved{if}} &{\reserved{import}} &{\reserved{in}} \\
|
||||
{\reserved{let}} &{\reserved{of}} &{\reserved{rec}} \\
|
||||
{\reserved{sig}} &{\reserved{then}} &{\reserved{where}} \\
|
||||
\end{tabular}\\
|
||||
|
||||
The symbols used in Syntax are the following: \\
|
||||
@@ -58,12 +58,14 @@ The symbols used in Syntax are the following: \\
|
||||
{\symb{;}} &{\symb{:}} &{\symb{\{}} \\
|
||||
{\symb{\}}} &{\symb{{$=$}}} &{\symb{(}} \\
|
||||
{\symb{)}} &{\symb{\_}} &{\symb{{$-$}{$>$}}} \\
|
||||
{\symb{$\backslash$}} &{\symb{{$|$}{$|$}}} &{\symb{\&\&}} \\
|
||||
{\symb{{$<$}{$-$}}} &{\symb{$\backslash$}} &{\symb{{$>$}{$>$}{$=$}}} \\
|
||||
{\symb{{$>$}{$>$}}} &{\symb{{$|$}{$|$}}} &{\symb{\&\&}} \\
|
||||
{\symb{{$=$}{$=$}}} &{\symb{/{$=$}}} &{\symb{{$<$}}} \\
|
||||
{\symb{{$<$}{$=$}}} &{\symb{{$>$}}} &{\symb{{$>$}{$=$}}} \\
|
||||
{\symb{{$+$}}} &{\symb{{$-$}}} &{\symb{*}} \\
|
||||
{\symb{/}} &{\symb{\%}} &{\symb{.}} \\
|
||||
{\symb{?}} & & \\
|
||||
{\symb{::}} &{\symb{{$+$}}} &{\symb{{$-$}}} \\
|
||||
{\symb{*}} &{\symb{/}} &{\symb{\%}} \\
|
||||
{\symb{.}} &{\symb{[}} &{\symb{]}} \\
|
||||
{\symb{?}} &{\symb{,}} & \\
|
||||
\end{tabular}\\
|
||||
|
||||
\subsection*{Comments}
|
||||
@@ -146,6 +148,7 @@ All other symbols are terminals.\\
|
||||
{\nonterminal{Exp}} & {\arrow} &{\terminal{let}} {\terminal{\{}} {\nonterminal{ListLetDef}} {\terminal{\}}} {\terminal{in}} {\nonterminal{Exp}} \\
|
||||
& {\delimit} &{\terminal{case}} {\nonterminal{Exp}} {\terminal{of}} {\terminal{\{}} {\nonterminal{ListCase}} {\terminal{\}}} \\
|
||||
& {\delimit} &{\terminal{if}} {\nonterminal{Exp}} {\terminal{then}} {\nonterminal{Exp}} {\terminal{else}} {\nonterminal{Exp}} \\
|
||||
& {\delimit} &{\terminal{do}} {\terminal{\{}} {\nonterminal{ListBind}} {\nonterminal{Exp}} {\terminal{\}}} \\
|
||||
& {\delimit} &{\nonterminal{Exp1}} \\
|
||||
\end{tabular}\\
|
||||
|
||||
@@ -169,6 +172,16 @@ All other symbols are terminals.\\
|
||||
& {\delimit} &{\nonterminal{Case}} {\terminal{;}} {\nonterminal{ListCase}} \\
|
||||
\end{tabular}\\
|
||||
|
||||
\begin{tabular}{lll}
|
||||
{\nonterminal{Bind}} & {\arrow} &{\nonterminal{VarOrWild}} {\terminal{{$<$}{$-$}}} {\nonterminal{Exp}} \\
|
||||
& {\delimit} &{\nonterminal{Exp}} \\
|
||||
\end{tabular}\\
|
||||
|
||||
\begin{tabular}{lll}
|
||||
{\nonterminal{ListBind}} & {\arrow} &{\emptyP} \\
|
||||
& {\delimit} &{\nonterminal{Bind}} {\terminal{;}} {\nonterminal{ListBind}} \\
|
||||
\end{tabular}\\
|
||||
|
||||
\begin{tabular}{lll}
|
||||
{\nonterminal{Exp2}} & {\arrow} &{\terminal{$\backslash$}} {\nonterminal{VarOrWild}} {\terminal{{$-$}{$>$}}} {\nonterminal{Exp}} \\
|
||||
& {\delimit} &{\terminal{(}} {\nonterminal{VarOrWild}} {\terminal{:}} {\nonterminal{Exp}} {\terminal{)}} {\terminal{{$-$}{$>$}}} {\nonterminal{Exp}} \\
|
||||
@@ -182,56 +195,68 @@ All other symbols are terminals.\\
|
||||
\end{tabular}\\
|
||||
|
||||
\begin{tabular}{lll}
|
||||
{\nonterminal{Exp3}} & {\arrow} &{\nonterminal{Exp4}} {\terminal{{$|$}{$|$}}} {\nonterminal{Exp3}} \\
|
||||
{\nonterminal{Exp3}} & {\arrow} &{\nonterminal{Exp3}} {\terminal{{$>$}{$>$}{$=$}}} {\nonterminal{Exp4}} \\
|
||||
& {\delimit} &{\nonterminal{Exp3}} {\terminal{{$>$}{$>$}}} {\nonterminal{Exp4}} \\
|
||||
& {\delimit} &{\nonterminal{Exp4}} \\
|
||||
\end{tabular}\\
|
||||
|
||||
\begin{tabular}{lll}
|
||||
{\nonterminal{Exp4}} & {\arrow} &{\nonterminal{Exp5}} {\terminal{\&\&}} {\nonterminal{Exp4}} \\
|
||||
{\nonterminal{Exp4}} & {\arrow} &{\nonterminal{Exp5}} {\terminal{{$|$}{$|$}}} {\nonterminal{Exp4}} \\
|
||||
& {\delimit} &{\nonterminal{Exp5}} \\
|
||||
\end{tabular}\\
|
||||
|
||||
\begin{tabular}{lll}
|
||||
{\nonterminal{Exp5}} & {\arrow} &{\nonterminal{Exp6}} {\terminal{{$=$}{$=$}}} {\nonterminal{Exp6}} \\
|
||||
& {\delimit} &{\nonterminal{Exp6}} {\terminal{/{$=$}}} {\nonterminal{Exp6}} \\
|
||||
& {\delimit} &{\nonterminal{Exp6}} {\terminal{{$<$}}} {\nonterminal{Exp6}} \\
|
||||
& {\delimit} &{\nonterminal{Exp6}} {\terminal{{$<$}{$=$}}} {\nonterminal{Exp6}} \\
|
||||
& {\delimit} &{\nonterminal{Exp6}} {\terminal{{$>$}}} {\nonterminal{Exp6}} \\
|
||||
& {\delimit} &{\nonterminal{Exp6}} {\terminal{{$>$}{$=$}}} {\nonterminal{Exp6}} \\
|
||||
{\nonterminal{Exp5}} & {\arrow} &{\nonterminal{Exp6}} {\terminal{\&\&}} {\nonterminal{Exp5}} \\
|
||||
& {\delimit} &{\nonterminal{Exp6}} \\
|
||||
\end{tabular}\\
|
||||
|
||||
\begin{tabular}{lll}
|
||||
{\nonterminal{Exp6}} & {\arrow} &{\nonterminal{Exp6}} {\terminal{{$+$}}} {\nonterminal{Exp7}} \\
|
||||
& {\delimit} &{\nonterminal{Exp6}} {\terminal{{$-$}}} {\nonterminal{Exp7}} \\
|
||||
{\nonterminal{Exp6}} & {\arrow} &{\nonterminal{Exp7}} {\terminal{{$=$}{$=$}}} {\nonterminal{Exp7}} \\
|
||||
& {\delimit} &{\nonterminal{Exp7}} {\terminal{/{$=$}}} {\nonterminal{Exp7}} \\
|
||||
& {\delimit} &{\nonterminal{Exp7}} {\terminal{{$<$}}} {\nonterminal{Exp7}} \\
|
||||
& {\delimit} &{\nonterminal{Exp7}} {\terminal{{$<$}{$=$}}} {\nonterminal{Exp7}} \\
|
||||
& {\delimit} &{\nonterminal{Exp7}} {\terminal{{$>$}}} {\nonterminal{Exp7}} \\
|
||||
& {\delimit} &{\nonterminal{Exp7}} {\terminal{{$>$}{$=$}}} {\nonterminal{Exp7}} \\
|
||||
& {\delimit} &{\nonterminal{Exp7}} \\
|
||||
\end{tabular}\\
|
||||
|
||||
\begin{tabular}{lll}
|
||||
{\nonterminal{Exp7}} & {\arrow} &{\nonterminal{Exp7}} {\terminal{*}} {\nonterminal{Exp8}} \\
|
||||
& {\delimit} &{\nonterminal{Exp7}} {\terminal{/}} {\nonterminal{Exp8}} \\
|
||||
& {\delimit} &{\nonterminal{Exp7}} {\terminal{\%}} {\nonterminal{Exp8}} \\
|
||||
{\nonterminal{Exp7}} & {\arrow} &{\nonterminal{Exp8}} {\terminal{::}} {\nonterminal{Exp7}} \\
|
||||
& {\delimit} &{\nonterminal{Exp8}} \\
|
||||
\end{tabular}\\
|
||||
|
||||
\begin{tabular}{lll}
|
||||
{\nonterminal{Exp8}} & {\arrow} &{\terminal{{$-$}}} {\nonterminal{Exp8}} \\
|
||||
{\nonterminal{Exp8}} & {\arrow} &{\nonterminal{Exp8}} {\terminal{{$+$}}} {\nonterminal{Exp9}} \\
|
||||
& {\delimit} &{\nonterminal{Exp8}} {\terminal{{$-$}}} {\nonterminal{Exp9}} \\
|
||||
& {\delimit} &{\nonterminal{Exp9}} \\
|
||||
\end{tabular}\\
|
||||
|
||||
\begin{tabular}{lll}
|
||||
{\nonterminal{Exp9}} & {\arrow} &{\nonterminal{Exp9}} {\nonterminal{Exp10}} \\
|
||||
{\nonterminal{Exp9}} & {\arrow} &{\nonterminal{Exp9}} {\terminal{*}} {\nonterminal{Exp10}} \\
|
||||
& {\delimit} &{\nonterminal{Exp9}} {\terminal{/}} {\nonterminal{Exp10}} \\
|
||||
& {\delimit} &{\nonterminal{Exp9}} {\terminal{\%}} {\nonterminal{Exp10}} \\
|
||||
& {\delimit} &{\nonterminal{Exp10}} \\
|
||||
\end{tabular}\\
|
||||
|
||||
\begin{tabular}{lll}
|
||||
{\nonterminal{Exp10}} & {\arrow} &{\nonterminal{Exp10}} {\terminal{.}} {\nonterminal{Ident}} \\
|
||||
{\nonterminal{Exp10}} & {\arrow} &{\terminal{{$-$}}} {\nonterminal{Exp10}} \\
|
||||
& {\delimit} &{\nonterminal{Exp11}} \\
|
||||
\end{tabular}\\
|
||||
|
||||
\begin{tabular}{lll}
|
||||
{\nonterminal{Exp11}} & {\arrow} &{\terminal{sig}} {\terminal{\{}} {\nonterminal{ListFieldType}} {\terminal{\}}} \\
|
||||
{\nonterminal{Exp11}} & {\arrow} &{\nonterminal{Exp11}} {\nonterminal{Exp12}} \\
|
||||
& {\delimit} &{\nonterminal{Exp12}} \\
|
||||
\end{tabular}\\
|
||||
|
||||
\begin{tabular}{lll}
|
||||
{\nonterminal{Exp12}} & {\arrow} &{\nonterminal{Exp12}} {\terminal{.}} {\nonterminal{Ident}} \\
|
||||
& {\delimit} &{\nonterminal{Exp13}} \\
|
||||
\end{tabular}\\
|
||||
|
||||
\begin{tabular}{lll}
|
||||
{\nonterminal{Exp13}} & {\arrow} &{\terminal{sig}} {\terminal{\{}} {\nonterminal{ListFieldType}} {\terminal{\}}} \\
|
||||
& {\delimit} &{\terminal{rec}} {\terminal{\{}} {\nonterminal{ListFieldValue}} {\terminal{\}}} \\
|
||||
& {\delimit} &{\terminal{[}} {\nonterminal{ListExp}} {\terminal{]}} \\
|
||||
& {\delimit} &{\nonterminal{Ident}} \\
|
||||
& {\delimit} &{\terminal{Type}} \\
|
||||
& {\delimit} &{\nonterminal{String}} \\
|
||||
@@ -264,6 +289,12 @@ All other symbols are terminals.\\
|
||||
{\nonterminal{Exp1}} & {\arrow} &{\nonterminal{Exp2}} \\
|
||||
\end{tabular}\\
|
||||
|
||||
\begin{tabular}{lll}
|
||||
{\nonterminal{ListExp}} & {\arrow} &{\emptyP} \\
|
||||
& {\delimit} &{\nonterminal{Exp}} \\
|
||||
& {\delimit} &{\nonterminal{Exp}} {\terminal{,}} {\nonterminal{ListExp}} \\
|
||||
\end{tabular}\\
|
||||
|
||||
|
||||
|
||||
\end{document}
|
||||
|
||||
@@ -10,7 +10,7 @@ import Data.Maybe (isNothing, fromJust)
|
||||
-- local parameters
|
||||
|
||||
topLayout = True
|
||||
layoutWords = ["let","where","of","rec","sig"]
|
||||
layoutWords = ["let","where","of","rec","sig","do"]
|
||||
layoutStopWords = ["in"]
|
||||
|
||||
-- layout separators
|
||||
|
||||
@@ -24,18 +24,18 @@ import GHC.Exts
|
||||
import GlaExts
|
||||
#endif
|
||||
alex_base :: AlexAddr
|
||||
alex_base = AlexA# "\x01\x00\x00\x00\x15\x00\x00\x00\x39\x00\x00\x00\x3a\x00\x00\x00\x18\x00\x00\x00\x19\x00\x00\x00\x1a\x00\x00\x00\x00\x00\x00\x00\x44\x00\x00\x00\x45\x00\x00\x00\x1b\x00\x00\x00\x1c\x00\x00\x00\x1d\x00\x00\x00\x42\x00\x00\x00\x00\x00\x00\x00\x13\x00\x00\x00\x14\x00\x00\x00\x16\x00\x00\x00\x17\x00\x00\x00\xd6\xff\xff\xff\x2f\x00\x00\x00\x9c\x00\x00\x00\x00\x00\x00\x00\x17\x01\x00\x00\xd5\x00\x00\x00\x33\x00\x00\x00"#
|
||||
alex_base = AlexA# "\x01\x00\x00\x00\x15\x00\x00\x00\x39\x00\x00\x00\x3a\x00\x00\x00\x18\x00\x00\x00\x19\x00\x00\x00\x1a\x00\x00\x00\x00\x00\x00\x00\x44\x00\x00\x00\x45\x00\x00\x00\x1b\x00\x00\x00\x1c\x00\x00\x00\x1d\x00\x00\x00\x42\x00\x00\x00\x00\x00\x00\x00\x26\x00\x00\x00\x13\x00\x00\x00\x14\x00\x00\x00\x17\x00\x00\x00\x1e\x00\x00\x00\x1f\x00\x00\x00\xd9\xff\xff\xff\x30\x00\x00\x00\x9c\x00\x00\x00\x00\x00\x00\x00\x17\x01\x00\x00\xd5\x00\x00\x00\x34\x00\x00\x00"#
|
||||
|
||||
alex_table :: AlexAddr
|
||||
alex_table = AlexA# "\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0d\x00\x0d\x00\x0d\x00\x0d\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0d\x00\xff\xff\x17\x00\xff\xff\xff\xff\x0e\x00\x14\x00\xff\xff\x0e\x00\x0e\x00\x0e\x00\x0e\x00\xff\xff\x05\x00\x0e\x00\x10\x00\x19\x00\x19\x00\x19\x00\x19\x00\x19\x00\x19\x00\x19\x00\x19\x00\x19\x00\x19\x00\x0e\x00\x0e\x00\x11\x00\x0f\x00\x12\x00\x0e\x00\xff\xff\x04\x00\xff\xff\xff\xff\x03\x00\x03\x00\x09\x00\x09\x00\x09\x00\x0b\x00\x0d\x00\x0d\x00\x0d\x00\x0d\x00\x0d\x00\x0e\x00\x0e\x00\x0e\x00\x0e\x00\x0e\x00\x0e\x00\x00\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x0e\x00\xff\xff\xff\xff\x0e\x00\xff\xff\x0d\x00\x19\x00\x19\x00\x19\x00\x19\x00\x19\x00\x19\x00\x19\x00\x19\x00\x19\x00\x19\x00\x00\x00\x00\x00\x00\x00\x00\x00\x09\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0c\x00\x13\x00\x0e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x06\x00\x07\x00\x15\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x17\x00\xff\xff\x00\x00\x00\x00\x15\x00\x17\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x17\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x16\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x17\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x17\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x18\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"#
|
||||
alex_table = AlexA# "\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0d\x00\x0d\x00\x0d\x00\x0d\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0d\x00\xff\xff\x19\x00\xff\xff\xff\xff\x0e\x00\x16\x00\xff\xff\x0e\x00\x0e\x00\x0e\x00\x0e\x00\x0e\x00\x05\x00\x0e\x00\x13\x00\x1b\x00\x1b\x00\x1b\x00\x1b\x00\x1b\x00\x1b\x00\x1b\x00\x1b\x00\x1b\x00\x1b\x00\x14\x00\x0e\x00\x0f\x00\x12\x00\x11\x00\x0e\x00\xff\xff\x04\x00\xff\xff\xff\xff\x03\x00\x03\x00\x09\x00\x09\x00\x09\x00\x0b\x00\x0d\x00\x0d\x00\x0d\x00\x0d\x00\x0d\x00\x0e\x00\x0e\x00\x10\x00\x0e\x00\x0e\x00\x0e\x00\x0e\x00\x0e\x00\x00\x00\x0e\x00\x00\x00\x0e\x00\x0e\x00\x0e\x00\x0e\x00\xff\xff\x0e\x00\xff\xff\x0d\x00\x0e\x00\x1b\x00\x1b\x00\x1b\x00\x1b\x00\x1b\x00\x1b\x00\x1b\x00\x1b\x00\x1b\x00\x1b\x00\x00\x00\x00\x00\x00\x00\x09\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0c\x00\x15\x00\x0e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x06\x00\x07\x00\x17\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x19\x00\xff\xff\x00\x00\x00\x00\x17\x00\x19\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x19\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x19\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x19\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x1a\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x00\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"#
|
||||
|
||||
alex_check :: AlexAddr
|
||||
alex_check = AlexA# "\xff\xff\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x07\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x29\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x3c\x00\x3d\x00\x3e\x00\x3f\x00\x40\x00\x2d\x00\x0a\x00\x0a\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x3d\x00\x3d\x00\x7c\x00\x3d\x00\x3d\x00\x26\x00\xff\xff\x3e\x00\xff\xff\xff\xff\xff\xff\xff\xff\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x20\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\xff\xff\x2d\x00\x2d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x7b\x00\x7c\x00\x7d\x00\x7e\x00\x7f\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\x7d\x00\x7d\x00\x27\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xd7\x00\xff\xff\xff\xff\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x22\x00\xf7\x00\xff\xff\xff\xff\x5f\x00\x27\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x5c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x22\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x6e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x74\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\x5c\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xff\xff\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"#
|
||||
alex_check = AlexA# "\xff\xff\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x07\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x29\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x3c\x00\x3d\x00\x3e\x00\x3f\x00\x40\x00\x2d\x00\x0a\x00\x0a\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x3d\x00\x3d\x00\x3e\x00\x2d\x00\x3d\x00\x7c\x00\x26\x00\x3e\x00\xff\xff\x3a\x00\xff\xff\x3d\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x20\x00\x3d\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\x2d\x00\x2d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x7b\x00\x7c\x00\x7d\x00\x7e\x00\x7f\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\x7d\x00\x7d\x00\x27\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xd7\x00\xff\xff\xff\xff\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x22\x00\xf7\x00\xff\xff\xff\xff\x5f\x00\x27\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x5c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x22\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x6e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x74\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\x5c\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xff\xff\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"#
|
||||
|
||||
alex_deflt :: AlexAddr
|
||||
alex_deflt = AlexA# "\x15\x00\xff\xff\x02\x00\x02\x00\xff\xff\xff\xff\x0a\x00\xff\xff\x0a\x00\x0a\x00\x0a\x00\x0a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x17\x00\xff\xff\xff\xff"#
|
||||
alex_deflt = AlexA# "\x17\x00\xff\xff\x02\x00\x02\x00\xff\xff\xff\xff\x0a\x00\xff\xff\x0a\x00\x0a\x00\x0a\x00\x0a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x19\x00\xff\xff\xff\xff"#
|
||||
|
||||
alex_accept = listArray (0::Int,25) [[],[],[(AlexAccSkip)],[(AlexAccSkip)],[],[(AlexAcc (alex_action_3))],[(AlexAccSkip)],[(AlexAccSkip)],[],[],[],[],[(AlexAcc (alex_action_3))],[(AlexAccSkip)],[(AlexAcc (alex_action_3))],[(AlexAcc (alex_action_3))],[(AlexAcc (alex_action_3))],[(AlexAcc (alex_action_3))],[(AlexAcc (alex_action_3))],[],[],[(AlexAcc (alex_action_4))],[(AlexAcc (alex_action_5))],[],[],[(AlexAcc (alex_action_6))]]
|
||||
alex_accept = listArray (0::Int,27) [[],[],[(AlexAccSkip)],[(AlexAccSkip)],[],[(AlexAcc (alex_action_3))],[(AlexAccSkip)],[(AlexAccSkip)],[],[],[],[],[(AlexAcc (alex_action_3))],[(AlexAccSkip)],[(AlexAcc (alex_action_3))],[(AlexAcc (alex_action_3))],[(AlexAcc (alex_action_3))],[(AlexAcc (alex_action_3))],[(AlexAcc (alex_action_3))],[(AlexAcc (alex_action_3))],[(AlexAcc (alex_action_3))],[],[],[(AlexAcc (alex_action_4))],[(AlexAcc (alex_action_5))],[],[],[(AlexAcc (alex_action_6))]]
|
||||
{-# LINE 34 "Transfer/Syntax/Lex.x" #-}
|
||||
|
||||
tok f p s = f p s
|
||||
@@ -84,7 +84,7 @@ eitherResIdent tv s = treeFind resWords
|
||||
| s > a = treeFind right
|
||||
| s == a = t
|
||||
|
||||
resWords = b "in" (b "derive" (b "case" (b "Type" N N) (b "data" N N)) (b "if" (b "else" N N) (b "import" N N))) (b "sig" (b "of" (b "let" N N) (b "rec" N N)) (b "where" (b "then" N N) N))
|
||||
resWords = b "import" (b "derive" (b "case" (b "Type" N N) (b "data" N N)) (b "else" (b "do" N N) (b "if" N N))) (b "rec" (b "let" (b "in" N N) (b "of" N N)) (b "then" (b "sig" N N) (b "where" N N)))
|
||||
where b s = B s (TS s)
|
||||
|
||||
unescapeInitTail :: String -> String
|
||||
|
||||
@@ -16,7 +16,7 @@ $i = [$l $d _ '] -- identifier character
|
||||
$u = [\0-\255] -- universal: any character
|
||||
|
||||
@rsyms = -- reserved words consisting of special symbols
|
||||
\; | \: | \{ | \} | \= | \( | \) | \_ | \- \> | \\ | \| \| | \& \& | \= \= | \/ \= | \< | \< \= | \> | \> \= | \+ | \- | \* | \/ | \% | \. | \?
|
||||
\; | \: | \{ | \} | \= | \( | \) | \_ | \- \> | \< \- | \\ | \> \> \= | \> \> | \| \| | \& \& | \= \= | \/ \= | \< | \< \= | \> | \> \= | \: \: | \+ | \- | \* | \/ | \% | \. | \[ | \] | \? | \,
|
||||
|
||||
:-
|
||||
"--" [.]* ; -- Toss single line comments
|
||||
@@ -79,7 +79,7 @@ eitherResIdent tv s = treeFind resWords
|
||||
| s > a = treeFind right
|
||||
| s == a = t
|
||||
|
||||
resWords = b "in" (b "derive" (b "case" (b "Type" N N) (b "data" N N)) (b "if" (b "else" N N) (b "import" N N))) (b "sig" (b "of" (b "let" N N) (b "rec" N N)) (b "where" (b "then" N N) N))
|
||||
resWords = b "import" (b "derive" (b "case" (b "Type" N N) (b "data" N N)) (b "else" (b "do" N N) (b "if" N N))) (b "rec" (b "let" (b "in" N N) (b "of" N N)) (b "then" (b "sig" N N) (b "where" N N)))
|
||||
where b s = B s (TS s)
|
||||
|
||||
unescapeInitTail :: String -> String
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -23,7 +23,10 @@ import Transfer.ErrM
|
||||
')' { PT _ (TS ")") }
|
||||
'_' { PT _ (TS "_") }
|
||||
'->' { PT _ (TS "->") }
|
||||
'<-' { PT _ (TS "<-") }
|
||||
'\\' { PT _ (TS "\\") }
|
||||
'>>=' { PT _ (TS ">>=") }
|
||||
'>>' { PT _ (TS ">>") }
|
||||
'||' { PT _ (TS "||") }
|
||||
'&&' { PT _ (TS "&&") }
|
||||
'==' { PT _ (TS "==") }
|
||||
@@ -32,17 +35,22 @@ import Transfer.ErrM
|
||||
'<=' { PT _ (TS "<=") }
|
||||
'>' { PT _ (TS ">") }
|
||||
'>=' { PT _ (TS ">=") }
|
||||
'::' { PT _ (TS "::") }
|
||||
'+' { PT _ (TS "+") }
|
||||
'-' { PT _ (TS "-") }
|
||||
'*' { PT _ (TS "*") }
|
||||
'/' { PT _ (TS "/") }
|
||||
'%' { PT _ (TS "%") }
|
||||
'.' { PT _ (TS ".") }
|
||||
'[' { PT _ (TS "[") }
|
||||
']' { PT _ (TS "]") }
|
||||
'?' { PT _ (TS "?") }
|
||||
',' { PT _ (TS ",") }
|
||||
'Type' { PT _ (TS "Type") }
|
||||
'case' { PT _ (TS "case") }
|
||||
'data' { PT _ (TS "data") }
|
||||
'derive' { PT _ (TS "derive") }
|
||||
'do' { PT _ (TS "do") }
|
||||
'else' { PT _ (TS "else") }
|
||||
'if' { PT _ (TS "if") }
|
||||
'import' { PT _ (TS "import") }
|
||||
@@ -137,6 +145,7 @@ Exp :: { Exp }
|
||||
Exp : 'let' '{' ListLetDef '}' 'in' Exp { ELet $3 $6 }
|
||||
| 'case' Exp 'of' '{' ListCase '}' { ECase $2 $5 }
|
||||
| 'if' Exp 'then' Exp 'else' Exp { EIf $2 $4 $6 }
|
||||
| 'do' '{' ListBind Exp '}' { EDo (reverse $3) $4 }
|
||||
| Exp1 { $1 }
|
||||
|
||||
|
||||
@@ -160,6 +169,16 @@ ListCase : {- empty -} { [] }
|
||||
| Case ';' ListCase { (:) $1 $3 }
|
||||
|
||||
|
||||
Bind :: { Bind }
|
||||
Bind : VarOrWild '<-' Exp { BindVar $1 $3 }
|
||||
| Exp { BindNoVar $1 }
|
||||
|
||||
|
||||
ListBind :: { [Bind] }
|
||||
ListBind : {- empty -} { [] }
|
||||
| ListBind Bind ';' { flip (:) $1 $2 }
|
||||
|
||||
|
||||
Exp2 :: { Exp }
|
||||
Exp2 : '\\' VarOrWild '->' Exp { EAbs $2 $4 }
|
||||
| '(' VarOrWild ':' Exp ')' '->' Exp { EPi $2 $4 $7 }
|
||||
@@ -173,56 +192,68 @@ VarOrWild : Ident { VVar $1 }
|
||||
|
||||
|
||||
Exp3 :: { Exp }
|
||||
Exp3 : Exp4 '||' Exp3 { EOr $1 $3 }
|
||||
Exp3 : Exp3 '>>=' Exp4 { EBind $1 $3 }
|
||||
| Exp3 '>>' Exp4 { EBindC $1 $3 }
|
||||
| Exp4 { $1 }
|
||||
|
||||
|
||||
Exp4 :: { Exp }
|
||||
Exp4 : Exp5 '&&' Exp4 { EAnd $1 $3 }
|
||||
Exp4 : Exp5 '||' Exp4 { EOr $1 $3 }
|
||||
| Exp5 { $1 }
|
||||
|
||||
|
||||
Exp5 :: { Exp }
|
||||
Exp5 : Exp6 '==' Exp6 { EEq $1 $3 }
|
||||
| Exp6 '/=' Exp6 { ENe $1 $3 }
|
||||
| Exp6 '<' Exp6 { ELt $1 $3 }
|
||||
| Exp6 '<=' Exp6 { ELe $1 $3 }
|
||||
| Exp6 '>' Exp6 { EGt $1 $3 }
|
||||
| Exp6 '>=' Exp6 { EGe $1 $3 }
|
||||
Exp5 : Exp6 '&&' Exp5 { EAnd $1 $3 }
|
||||
| Exp6 { $1 }
|
||||
|
||||
|
||||
Exp6 :: { Exp }
|
||||
Exp6 : Exp6 '+' Exp7 { EAdd $1 $3 }
|
||||
| Exp6 '-' Exp7 { ESub $1 $3 }
|
||||
Exp6 : Exp7 '==' Exp7 { EEq $1 $3 }
|
||||
| Exp7 '/=' Exp7 { ENe $1 $3 }
|
||||
| Exp7 '<' Exp7 { ELt $1 $3 }
|
||||
| Exp7 '<=' Exp7 { ELe $1 $3 }
|
||||
| Exp7 '>' Exp7 { EGt $1 $3 }
|
||||
| Exp7 '>=' Exp7 { EGe $1 $3 }
|
||||
| Exp7 { $1 }
|
||||
|
||||
|
||||
Exp7 :: { Exp }
|
||||
Exp7 : Exp7 '*' Exp8 { EMul $1 $3 }
|
||||
| Exp7 '/' Exp8 { EDiv $1 $3 }
|
||||
| Exp7 '%' Exp8 { EMod $1 $3 }
|
||||
Exp7 : Exp8 '::' Exp7 { EListCons $1 $3 }
|
||||
| Exp8 { $1 }
|
||||
|
||||
|
||||
Exp8 :: { Exp }
|
||||
Exp8 : '-' Exp8 { ENeg $2 }
|
||||
Exp8 : Exp8 '+' Exp9 { EAdd $1 $3 }
|
||||
| Exp8 '-' Exp9 { ESub $1 $3 }
|
||||
| Exp9 { $1 }
|
||||
|
||||
|
||||
Exp9 :: { Exp }
|
||||
Exp9 : Exp9 Exp10 { EApp $1 $2 }
|
||||
Exp9 : Exp9 '*' Exp10 { EMul $1 $3 }
|
||||
| Exp9 '/' Exp10 { EDiv $1 $3 }
|
||||
| Exp9 '%' Exp10 { EMod $1 $3 }
|
||||
| Exp10 { $1 }
|
||||
|
||||
|
||||
Exp10 :: { Exp }
|
||||
Exp10 : Exp10 '.' Ident { EProj $1 $3 }
|
||||
Exp10 : '-' Exp10 { ENeg $2 }
|
||||
| Exp11 { $1 }
|
||||
|
||||
|
||||
Exp11 :: { Exp }
|
||||
Exp11 : 'sig' '{' ListFieldType '}' { ERecType $3 }
|
||||
Exp11 : Exp11 Exp12 { EApp $1 $2 }
|
||||
| Exp12 { $1 }
|
||||
|
||||
|
||||
Exp12 :: { Exp }
|
||||
Exp12 : Exp12 '.' Ident { EProj $1 $3 }
|
||||
| Exp13 { $1 }
|
||||
|
||||
|
||||
Exp13 :: { Exp }
|
||||
Exp13 : 'sig' '{' ListFieldType '}' { ERecType $3 }
|
||||
| 'rec' '{' ListFieldValue '}' { ERec $3 }
|
||||
| '[' ListExp ']' { EList $2 }
|
||||
| Ident { EVar $1 }
|
||||
| 'Type' { EType }
|
||||
| String { EStr $1 }
|
||||
@@ -255,6 +286,12 @@ Exp1 :: { Exp }
|
||||
Exp1 : Exp2 { $1 }
|
||||
|
||||
|
||||
ListExp :: { [Exp] }
|
||||
ListExp : {- empty -} { [] }
|
||||
| Exp { (:[]) $1 }
|
||||
| Exp ',' ListExp { (:) $1 $3 }
|
||||
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
@@ -99,34 +99,41 @@ instance Print (Tree c) where
|
||||
ELet letdefs exp -> prPrec _i 0 (concatD [doc (showString "let") , doc (showString "{") , prt 0 letdefs , doc (showString "}") , doc (showString "in") , prt 0 exp])
|
||||
ECase exp cases -> prPrec _i 0 (concatD [doc (showString "case") , prt 0 exp , doc (showString "of") , doc (showString "{") , prt 0 cases , doc (showString "}")])
|
||||
EIf exp0 exp1 exp2 -> prPrec _i 0 (concatD [doc (showString "if") , prt 0 exp0 , doc (showString "then") , prt 0 exp1 , doc (showString "else") , prt 0 exp2])
|
||||
EDo binds exp -> prPrec _i 0 (concatD [doc (showString "do") , doc (showString "{") , prt 0 binds , prt 0 exp , doc (showString "}")])
|
||||
EAbs varorwild exp -> prPrec _i 2 (concatD [doc (showString "\\") , prt 0 varorwild , doc (showString "->") , prt 0 exp])
|
||||
EPi varorwild exp0 exp1 -> prPrec _i 2 (concatD [doc (showString "(") , prt 0 varorwild , doc (showString ":") , prt 0 exp0 , doc (showString ")") , doc (showString "->") , prt 0 exp1])
|
||||
EPiNoVar exp0 exp1 -> prPrec _i 2 (concatD [prt 3 exp0 , doc (showString "->") , prt 0 exp1])
|
||||
EOr exp0 exp1 -> prPrec _i 3 (concatD [prt 4 exp0 , doc (showString "||") , prt 3 exp1])
|
||||
EAnd exp0 exp1 -> prPrec _i 4 (concatD [prt 5 exp0 , doc (showString "&&") , prt 4 exp1])
|
||||
EEq exp0 exp1 -> prPrec _i 5 (concatD [prt 6 exp0 , doc (showString "==") , prt 6 exp1])
|
||||
ENe exp0 exp1 -> prPrec _i 5 (concatD [prt 6 exp0 , doc (showString "/=") , prt 6 exp1])
|
||||
ELt exp0 exp1 -> prPrec _i 5 (concatD [prt 6 exp0 , doc (showString "<") , prt 6 exp1])
|
||||
ELe exp0 exp1 -> prPrec _i 5 (concatD [prt 6 exp0 , doc (showString "<=") , prt 6 exp1])
|
||||
EGt exp0 exp1 -> prPrec _i 5 (concatD [prt 6 exp0 , doc (showString ">") , prt 6 exp1])
|
||||
EGe exp0 exp1 -> prPrec _i 5 (concatD [prt 6 exp0 , doc (showString ">=") , prt 6 exp1])
|
||||
EAdd exp0 exp1 -> prPrec _i 6 (concatD [prt 6 exp0 , doc (showString "+") , prt 7 exp1])
|
||||
ESub exp0 exp1 -> prPrec _i 6 (concatD [prt 6 exp0 , doc (showString "-") , prt 7 exp1])
|
||||
EMul exp0 exp1 -> prPrec _i 7 (concatD [prt 7 exp0 , doc (showString "*") , prt 8 exp1])
|
||||
EDiv exp0 exp1 -> prPrec _i 7 (concatD [prt 7 exp0 , doc (showString "/") , prt 8 exp1])
|
||||
EMod exp0 exp1 -> prPrec _i 7 (concatD [prt 7 exp0 , doc (showString "%") , prt 8 exp1])
|
||||
ENeg exp -> prPrec _i 8 (concatD [doc (showString "-") , prt 8 exp])
|
||||
EApp exp0 exp1 -> prPrec _i 9 (concatD [prt 9 exp0 , prt 10 exp1])
|
||||
EProj exp i -> prPrec _i 10 (concatD [prt 10 exp , doc (showString ".") , prt 0 i])
|
||||
ERecType fieldtypes -> prPrec _i 11 (concatD [doc (showString "sig") , doc (showString "{") , prt 0 fieldtypes , doc (showString "}")])
|
||||
ERec fieldvalues -> prPrec _i 11 (concatD [doc (showString "rec") , doc (showString "{") , prt 0 fieldvalues , doc (showString "}")])
|
||||
EVar i -> prPrec _i 11 (concatD [prt 0 i])
|
||||
EType -> prPrec _i 11 (concatD [doc (showString "Type")])
|
||||
EStr str -> prPrec _i 11 (concatD [prt 0 str])
|
||||
EInt n -> prPrec _i 11 (concatD [prt 0 n])
|
||||
EMeta -> prPrec _i 11 (concatD [doc (showString "?")])
|
||||
EBind exp0 exp1 -> prPrec _i 3 (concatD [prt 3 exp0 , doc (showString ">>=") , prt 4 exp1])
|
||||
EBindC exp0 exp1 -> prPrec _i 3 (concatD [prt 3 exp0 , doc (showString ">>") , prt 4 exp1])
|
||||
EOr exp0 exp1 -> prPrec _i 4 (concatD [prt 5 exp0 , doc (showString "||") , prt 4 exp1])
|
||||
EAnd exp0 exp1 -> prPrec _i 5 (concatD [prt 6 exp0 , doc (showString "&&") , prt 5 exp1])
|
||||
EEq exp0 exp1 -> prPrec _i 6 (concatD [prt 7 exp0 , doc (showString "==") , prt 7 exp1])
|
||||
ENe exp0 exp1 -> prPrec _i 6 (concatD [prt 7 exp0 , doc (showString "/=") , prt 7 exp1])
|
||||
ELt exp0 exp1 -> prPrec _i 6 (concatD [prt 7 exp0 , doc (showString "<") , prt 7 exp1])
|
||||
ELe exp0 exp1 -> prPrec _i 6 (concatD [prt 7 exp0 , doc (showString "<=") , prt 7 exp1])
|
||||
EGt exp0 exp1 -> prPrec _i 6 (concatD [prt 7 exp0 , doc (showString ">") , prt 7 exp1])
|
||||
EGe exp0 exp1 -> prPrec _i 6 (concatD [prt 7 exp0 , doc (showString ">=") , prt 7 exp1])
|
||||
EListCons exp0 exp1 -> prPrec _i 7 (concatD [prt 8 exp0 , doc (showString "::") , prt 7 exp1])
|
||||
EAdd exp0 exp1 -> prPrec _i 8 (concatD [prt 8 exp0 , doc (showString "+") , prt 9 exp1])
|
||||
ESub exp0 exp1 -> prPrec _i 8 (concatD [prt 8 exp0 , doc (showString "-") , prt 9 exp1])
|
||||
EMul exp0 exp1 -> prPrec _i 9 (concatD [prt 9 exp0 , doc (showString "*") , prt 10 exp1])
|
||||
EDiv exp0 exp1 -> prPrec _i 9 (concatD [prt 9 exp0 , doc (showString "/") , prt 10 exp1])
|
||||
EMod exp0 exp1 -> prPrec _i 9 (concatD [prt 9 exp0 , doc (showString "%") , prt 10 exp1])
|
||||
ENeg exp -> prPrec _i 10 (concatD [doc (showString "-") , prt 10 exp])
|
||||
EApp exp0 exp1 -> prPrec _i 11 (concatD [prt 11 exp0 , prt 12 exp1])
|
||||
EProj exp i -> prPrec _i 12 (concatD [prt 12 exp , doc (showString ".") , prt 0 i])
|
||||
ERecType fieldtypes -> prPrec _i 13 (concatD [doc (showString "sig") , doc (showString "{") , prt 0 fieldtypes , doc (showString "}")])
|
||||
ERec fieldvalues -> prPrec _i 13 (concatD [doc (showString "rec") , doc (showString "{") , prt 0 fieldvalues , doc (showString "}")])
|
||||
EList exps -> prPrec _i 13 (concatD [doc (showString "[") , prt 0 exps , doc (showString "]")])
|
||||
EVar i -> prPrec _i 13 (concatD [prt 0 i])
|
||||
EType -> prPrec _i 13 (concatD [doc (showString "Type")])
|
||||
EStr str -> prPrec _i 13 (concatD [prt 0 str])
|
||||
EInt n -> prPrec _i 13 (concatD [prt 0 n])
|
||||
EMeta -> prPrec _i 13 (concatD [doc (showString "?")])
|
||||
LetDef i exp0 exp1 -> prPrec _i 0 (concatD [prt 0 i , doc (showString ":") , prt 0 exp0 , doc (showString "=") , prt 0 exp1])
|
||||
Case pattern exp -> prPrec _i 0 (concatD [prt 0 pattern , doc (showString "->") , prt 0 exp])
|
||||
BindVar varorwild exp -> prPrec _i 0 (concatD [prt 0 varorwild , doc (showString "<-") , prt 0 exp])
|
||||
BindNoVar exp -> prPrec _i 0 (concatD [prt 0 exp])
|
||||
VVar i -> prPrec _i 0 (concatD [prt 0 i])
|
||||
VWild -> prPrec _i 0 (concatD [doc (showString "_")])
|
||||
FieldType i exp -> prPrec _i 0 (concatD [prt 0 i , doc (showString ":") , prt 0 exp])
|
||||
@@ -167,6 +174,10 @@ instance Print [Case] where
|
||||
[] -> (concatD [])
|
||||
[x] -> (concatD [prt 0 x])
|
||||
x:xs -> (concatD [prt 0 x , doc (showString ";") , prt 0 xs])
|
||||
instance Print [Bind] where
|
||||
prt _ es = case es of
|
||||
[] -> (concatD [])
|
||||
x:xs -> (concatD [prt 0 x , doc (showString ";") , prt 0 xs])
|
||||
instance Print [FieldType] where
|
||||
prt _ es = case es of
|
||||
[] -> (concatD [])
|
||||
@@ -177,3 +188,8 @@ instance Print [FieldValue] where
|
||||
[] -> (concatD [])
|
||||
[x] -> (concatD [prt 0 x])
|
||||
x:xs -> (concatD [prt 0 x , doc (showString ";") , prt 0 xs])
|
||||
instance Print [Exp] where
|
||||
prt _ es = case es of
|
||||
[] -> (concatD [])
|
||||
[x] -> (concatD [prt 0 x])
|
||||
x:xs -> (concatD [prt 0 x , doc (showString ",") , prt 0 xs])
|
||||
|
||||
@@ -30,9 +30,12 @@ transTree t = case t of
|
||||
ELet letdefs exp -> failure t
|
||||
ECase exp cases -> failure t
|
||||
EIf exp0 exp1 exp2 -> failure t
|
||||
EDo binds exp -> failure t
|
||||
EAbs varorwild exp -> failure t
|
||||
EPi varorwild exp0 exp1 -> failure t
|
||||
EPiNoVar exp0 exp1 -> failure t
|
||||
EBind exp0 exp1 -> failure t
|
||||
EBindC exp0 exp1 -> failure t
|
||||
EOr exp0 exp1 -> failure t
|
||||
EAnd exp0 exp1 -> failure t
|
||||
EEq exp0 exp1 -> failure t
|
||||
@@ -41,6 +44,7 @@ transTree t = case t of
|
||||
ELe exp0 exp1 -> failure t
|
||||
EGt exp0 exp1 -> failure t
|
||||
EGe exp0 exp1 -> failure t
|
||||
EListCons exp0 exp1 -> failure t
|
||||
EAdd exp0 exp1 -> failure t
|
||||
ESub exp0 exp1 -> failure t
|
||||
EMul exp0 exp1 -> failure t
|
||||
@@ -51,6 +55,7 @@ transTree t = case t of
|
||||
EProj exp i -> failure t
|
||||
ERecType fieldtypes -> failure t
|
||||
ERec fieldvalues -> failure t
|
||||
EList exps -> failure t
|
||||
EVar i -> failure t
|
||||
EType -> failure t
|
||||
EStr str -> failure t
|
||||
@@ -58,6 +63,8 @@ transTree t = case t of
|
||||
EMeta -> failure t
|
||||
LetDef i exp0 exp1 -> failure t
|
||||
Case pattern exp -> failure t
|
||||
BindVar varorwild exp -> failure t
|
||||
BindNoVar exp -> failure t
|
||||
VVar i -> failure t
|
||||
VWild -> failure t
|
||||
FieldType i exp -> failure t
|
||||
@@ -103,9 +110,12 @@ transExp t = case t of
|
||||
ELet letdefs exp -> failure t
|
||||
ECase exp cases -> failure t
|
||||
EIf exp0 exp1 exp2 -> failure t
|
||||
EDo binds exp -> failure t
|
||||
EAbs varorwild exp -> failure t
|
||||
EPi varorwild exp0 exp1 -> failure t
|
||||
EPiNoVar exp0 exp1 -> failure t
|
||||
EBind exp0 exp1 -> failure t
|
||||
EBindC exp0 exp1 -> failure t
|
||||
EOr exp0 exp1 -> failure t
|
||||
EAnd exp0 exp1 -> failure t
|
||||
EEq exp0 exp1 -> failure t
|
||||
@@ -114,6 +124,7 @@ transExp t = case t of
|
||||
ELe exp0 exp1 -> failure t
|
||||
EGt exp0 exp1 -> failure t
|
||||
EGe exp0 exp1 -> failure t
|
||||
EListCons exp0 exp1 -> failure t
|
||||
EAdd exp0 exp1 -> failure t
|
||||
ESub exp0 exp1 -> failure t
|
||||
EMul exp0 exp1 -> failure t
|
||||
@@ -124,6 +135,7 @@ transExp t = case t of
|
||||
EProj exp i -> failure t
|
||||
ERecType fieldtypes -> failure t
|
||||
ERec fieldvalues -> failure t
|
||||
EList exps -> failure t
|
||||
EVar i -> failure t
|
||||
EType -> failure t
|
||||
EStr str -> failure t
|
||||
@@ -138,6 +150,11 @@ transCase :: Case -> Result
|
||||
transCase t = case t of
|
||||
Case pattern exp -> failure t
|
||||
|
||||
transBind :: Bind -> Result
|
||||
transBind t = case t of
|
||||
BindVar varorwild exp -> failure t
|
||||
BindNoVar exp -> failure t
|
||||
|
||||
transVarOrWild :: VarOrWild -> Result
|
||||
transVarOrWild t = case t of
|
||||
VVar i -> failure t
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
entrypoints Module, Exp ;
|
||||
|
||||
layout "let", "where", "of","rec", "sig" ;
|
||||
layout "let", "where", "of","rec", "sig", "do" ;
|
||||
layout stop "in" ;
|
||||
layout toplevel ;
|
||||
|
||||
@@ -56,53 +56,62 @@ separator Case ";" ;
|
||||
|
||||
EIf. Exp ::= "if" Exp "then" Exp "else" Exp ;
|
||||
|
||||
EDo. Exp ::= "do" "{" [Bind] Exp "}" ;
|
||||
BindVar. Bind ::= VarOrWild "<-" Exp ;
|
||||
BindNoVar. Bind ::= Exp ;
|
||||
terminator Bind ";" ;
|
||||
|
||||
EAbs. Exp2 ::= "\\" VarOrWild "->" Exp ;
|
||||
EPi. Exp2 ::= "(" VarOrWild ":" Exp ")" "->" Exp ;
|
||||
EPiNoVar. Exp2 ::= Exp3 "->" Exp ;
|
||||
VVar. VarOrWild ::= Ident ;
|
||||
VWild. VarOrWild ::= "_" ;
|
||||
|
||||
EOr. Exp3 ::= Exp4 "||" Exp3 ;
|
||||
EAnd. Exp4 ::= Exp5 "&&" Exp4 ;
|
||||
EBind. Exp3 ::= Exp3 ">>=" Exp4 ;
|
||||
EBindC. Exp3 ::= Exp3 ">>" Exp4 ;
|
||||
|
||||
EEq. Exp5 ::= Exp6 "==" Exp6 ;
|
||||
ENe. Exp5 ::= Exp6 "/=" Exp6 ;
|
||||
ELt. Exp5 ::= Exp6 "<" Exp6 ;
|
||||
ELe. Exp5 ::= Exp6 "<=" Exp6 ;
|
||||
EGt. Exp5 ::= Exp6 ">" Exp6 ;
|
||||
EGe. Exp5 ::= Exp6 ">=" Exp6 ;
|
||||
EOr. Exp4 ::= Exp5 "||" Exp4 ;
|
||||
|
||||
EAdd. Exp6 ::= Exp6 "+" Exp7 ;
|
||||
ESub. Exp6 ::= Exp6 "-" Exp7 ;
|
||||
EAnd. Exp5 ::= Exp6 "&&" Exp5 ;
|
||||
|
||||
EMul. Exp7 ::= Exp7 "*" Exp8 ;
|
||||
EDiv. Exp7 ::= Exp7 "/" Exp8 ;
|
||||
EMod. Exp7 ::= Exp7 "%" Exp8 ;
|
||||
EEq. Exp6 ::= Exp7 "==" Exp7 ;
|
||||
ENe. Exp6 ::= Exp7 "/=" Exp7 ;
|
||||
ELt. Exp6 ::= Exp7 "<" Exp7 ;
|
||||
ELe. Exp6 ::= Exp7 "<=" Exp7 ;
|
||||
EGt. Exp6 ::= Exp7 ">" Exp7 ;
|
||||
EGe. Exp6 ::= Exp7 ">=" Exp7 ;
|
||||
|
||||
ENeg. Exp8 ::= "-" Exp8 ;
|
||||
EListCons. Exp7 ::= Exp8 "::" Exp7 ;
|
||||
|
||||
EApp. Exp9 ::= Exp9 Exp10 ;
|
||||
EAdd. Exp8 ::= Exp8 "+" Exp9 ;
|
||||
ESub. Exp8 ::= Exp8 "-" Exp9 ;
|
||||
|
||||
EProj. Exp10 ::= Exp10 "." Ident ;
|
||||
EMul. Exp9 ::= Exp9 "*" Exp10 ;
|
||||
EDiv. Exp9 ::= Exp9 "/" Exp10 ;
|
||||
EMod. Exp9 ::= Exp9 "%" Exp10 ;
|
||||
|
||||
ERecType. Exp11 ::= "sig" "{" [FieldType] "}" ;
|
||||
ENeg. Exp10 ::= "-" Exp10 ;
|
||||
|
||||
EApp. Exp11 ::= Exp11 Exp12 ;
|
||||
|
||||
EProj. Exp12 ::= Exp12 "." Ident ;
|
||||
|
||||
ERecType. Exp13 ::= "sig" "{" [FieldType] "}" ;
|
||||
FieldType. FieldType ::= Ident ":" Exp ;
|
||||
separator FieldType ";" ;
|
||||
|
||||
ERec. Exp11 ::= "rec" "{" [FieldValue] "}" ;
|
||||
ERec. Exp13 ::= "rec" "{" [FieldValue] "}" ;
|
||||
FieldValue.FieldValue ::= Ident "=" Exp ;
|
||||
separator FieldValue ";" ;
|
||||
|
||||
EVar. Exp11 ::= Ident ;
|
||||
EType. Exp11 ::= "Type" ;
|
||||
EStr. Exp11 ::= String ;
|
||||
EInt. Exp11 ::= Integer ;
|
||||
EMeta. Exp11 ::= "?" ;
|
||||
|
||||
coercions Exp 11 ;
|
||||
|
||||
|
||||
|
||||
EList. Exp13 ::= "[" [Exp] "]" ;
|
||||
|
||||
EVar. Exp13 ::= Ident ;
|
||||
EType. Exp13 ::= "Type" ;
|
||||
EStr. Exp13 ::= String ;
|
||||
EInt. Exp13 ::= Integer ;
|
||||
EMeta. Exp13 ::= "?" ;
|
||||
|
||||
coercions Exp 13 ;
|
||||
|
||||
separator Exp "," ;
|
||||
|
||||
@@ -352,22 +352,28 @@ desugar = return . map f
|
||||
where
|
||||
f :: Tree a -> Tree a
|
||||
f x = case x of
|
||||
EIf exp0 exp1 exp2 -> ifBool <| exp0 <| exp1 <| exp2
|
||||
EPiNoVar exp0 exp1 -> EPi VWild <| exp0 <| exp1
|
||||
EOr exp0 exp1 -> andBool <| exp0 <| exp1
|
||||
EAnd exp0 exp1 -> orBool <| exp0 <| exp1
|
||||
EIf exp0 exp1 exp2 -> ifBool <| exp0 <| exp1 <| exp2
|
||||
EDo bs e -> mkDo (map f bs) (f e)
|
||||
BindNoVar exp0 -> BindVar VWild <| exp0
|
||||
EPiNoVar exp0 exp1 -> EPi VWild <| exp0 <| exp1
|
||||
EBind exp0 exp1 -> appBind <| exp0 <| exp1
|
||||
EBindC exp0 exp1 -> appBindC <| exp0 <| exp1
|
||||
EOr exp0 exp1 -> andBool <| exp0 <| exp1
|
||||
EAnd exp0 exp1 -> orBool <| exp0 <| exp1
|
||||
EEq exp0 exp1 -> overlBin "eq" <| exp0 <| exp1
|
||||
ENe exp0 exp1 -> overlBin "ne" <| exp0 <| exp1
|
||||
ELt exp0 exp1 -> overlBin "lt" <| exp0 <| exp1
|
||||
ELe exp0 exp1 -> overlBin "le" <| exp0 <| exp1
|
||||
EGt exp0 exp1 -> overlBin "gt" <| exp0 <| exp1
|
||||
EGe exp0 exp1 -> overlBin "ge" <| exp0 <| exp1
|
||||
EListCons exp0 exp1 -> appCons <| exp0 <| exp1
|
||||
EAdd exp0 exp1 -> overlBin "plus" <| exp0 <| exp1
|
||||
ESub exp0 exp1 -> overlBin "minus" <| exp0 <| exp1
|
||||
EMul exp0 exp1 -> overlBin "times" <| exp0 <| exp1
|
||||
EDiv exp0 exp1 -> overlBin "div" <| exp0 <| exp1
|
||||
EMod exp0 exp1 -> overlBin "mod" <| exp0 <| exp1
|
||||
ENeg exp0 -> overlUn "neg" <| exp0
|
||||
EList exps -> mkList (map f exps)
|
||||
_ -> composOp f x
|
||||
where g <| x = g (f x)
|
||||
|
||||
@@ -382,14 +388,28 @@ overlBin :: String -> Exp -> Exp -> Exp
|
||||
overlBin f e1 e2 = apply (EVar (Ident f)) [EMeta,EVar (Ident "num_Integer"),e1,e2] -- FIXME: hack, should be ?
|
||||
|
||||
--
|
||||
-- * Integers
|
||||
-- * Monad
|
||||
--
|
||||
|
||||
appIntUn :: String -> Exp -> Exp
|
||||
appIntUn f e = EApp (var ("prim_"++f++"_Int")) e
|
||||
mkDo :: [Bind] -> Exp -> Exp
|
||||
mkDo bs e = foldr (\ (BindVar v r) x -> appBind r (EAbs v x)) e bs
|
||||
|
||||
appBind :: Exp -> Exp -> Exp
|
||||
appBind e1 e2 = apply (EVar (Ident "bind")) [EMeta,EMeta,EMeta,EMeta,e1,e2]
|
||||
|
||||
appBindC :: Exp -> Exp -> Exp
|
||||
appBindC e1 e2 = appBind e1 (EAbs VWild e2)
|
||||
|
||||
--
|
||||
-- * List
|
||||
--
|
||||
|
||||
mkList :: [Exp] -> Exp
|
||||
mkList = foldr appCons (EApp (EVar (Ident "Nil")) EMeta)
|
||||
|
||||
appCons :: Exp -> Exp -> Exp
|
||||
appCons e1 e2 = apply (EVar (Ident "Cons")) [EMeta,e1,e2]
|
||||
|
||||
appIntBin :: String -> Exp -> Exp -> Exp
|
||||
appIntBin f e1 e2 = EApp (EApp (var ("prim_"++f++"_Int")) e1) e2
|
||||
|
||||
--
|
||||
-- * Booleans
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
main = ?
|
||||
import prelude
|
||||
|
||||
main = x :: y :: z :: []
|
||||
@@ -1,31 +0,0 @@
|
||||
import prelude
|
||||
import nat
|
||||
|
||||
data List : (_:Type) -> Type where
|
||||
Nil : (A:Type) -> List A
|
||||
Cons : (A:Type) -> A -> List A -> List A
|
||||
|
||||
size : (A:Type) -> List A -> Nat
|
||||
size _ (Nil _) = Zero
|
||||
size A (Cons _ x xs) = Succ (size A xs)
|
||||
|
||||
map : (A:Type) -> (B:Type) -> (A -> B) -> List A -> List B
|
||||
map _ B _ (Nil _) = Nil B
|
||||
map A B f (Cons _ x xs) = Cons B (f x) (map A B f xs)
|
||||
|
||||
append : (A:Type) -> (xs:List A) -> List A -> List A
|
||||
append A xs ys = foldr A (List A) (Cons A) ys xs
|
||||
|
||||
concat : (A : Type) -> List (List A) -> List A
|
||||
concat A = foldr (List A) (List A) (append A) (Nil A)
|
||||
|
||||
foldr : (A : Type) -> (B : Type) -> (A -> B -> B) -> B -> List A -> B
|
||||
foldr _ _ _ x (Nil _) = x
|
||||
foldr A B f x (Cons _ y ys) = f y (foldr A B f x ys)
|
||||
|
||||
-- Instances:
|
||||
|
||||
monad_List : Monad List
|
||||
monad_list = rec return = \A -> \x -> Cons A x (Nil A)
|
||||
bind = \A -> \B -> \m -> \k -> concat B (map A B k m)
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
import prelude
|
||||
|
||||
data Maybe : Type -> Type where
|
||||
Nothing : (A : Type) -> Maybe A
|
||||
Just : (A : Type) -> A -> Maybe A
|
||||
|
||||
fromMaybe : (A : Type) -> A -> Maybe A -> A
|
||||
fromMaybe _ x Nothing = x
|
||||
fromMaybe _ _ (Just x) = x
|
||||
|
||||
maybe : (A : Type) -> (B : Type) -> B -> (A -> B) -> Maybe A -> A
|
||||
maybe _ _ x _ Nothing = x
|
||||
maybe _ _ _ f (Just x) = f x
|
||||
|
||||
-- Instances:
|
||||
|
||||
monad_Maybe : Monad Maybe
|
||||
monad_Maybe =
|
||||
rec return = Just
|
||||
bind = \A -> \B -> \m -> \k ->
|
||||
case m of
|
||||
Nothing _ -> Nothing B
|
||||
Just _ x -> k x
|
||||
|
||||
@@ -15,7 +15,7 @@ id _ x = x
|
||||
|
||||
|
||||
--
|
||||
-- The Bool type
|
||||
-- The List type
|
||||
--
|
||||
|
||||
data Bool : Type where
|
||||
@@ -26,6 +26,46 @@ not : Bool -> Bool
|
||||
not b = if b then False else True
|
||||
|
||||
|
||||
data List : (_:Type) -> Type where
|
||||
Nil : (A:Type) -> List A
|
||||
Cons : (A:Type) -> A -> List A -> List A
|
||||
|
||||
size : (A:Type) -> List A -> Nat
|
||||
size _ (Nil _) = Zero
|
||||
size A (Cons _ x xs) = Succ (size A xs)
|
||||
|
||||
map : (A:Type) -> (B:Type) -> (A -> B) -> List A -> List B
|
||||
map _ B _ (Nil _) = Nil B
|
||||
map A B f (Cons _ x xs) = Cons B (f x) (map A B f xs)
|
||||
|
||||
append : (A:Type) -> (xs:List A) -> List A -> List A
|
||||
append A xs ys = foldr A (List A) (Cons A) ys xs
|
||||
|
||||
concat : (A : Type) -> List (List A) -> List A
|
||||
concat A = foldr (List A) (List A) (append A) (Nil A)
|
||||
|
||||
foldr : (A : Type) -> (B : Type) -> (A -> B -> B) -> B -> List A -> B
|
||||
foldr _ _ _ x (Nil _) = x
|
||||
foldr A B f x (Cons _ y ys) = f y (foldr A B f x ys)
|
||||
|
||||
|
||||
--
|
||||
-- The Maybe type
|
||||
--
|
||||
|
||||
data Maybe : Type -> Type where
|
||||
Nothing : (A : Type) -> Maybe A
|
||||
Just : (A : Type) -> A -> Maybe A
|
||||
|
||||
fromMaybe : (A : Type) -> A -> Maybe A -> A
|
||||
fromMaybe _ x Nothing = x
|
||||
fromMaybe _ _ (Just x) = x
|
||||
|
||||
maybe : (A : Type) -> (B : Type) -> B -> (A -> B) -> Maybe A -> A
|
||||
maybe _ _ x _ Nothing = x
|
||||
maybe _ _ _ f (Just x) = f x
|
||||
|
||||
|
||||
--
|
||||
-- The Num class
|
||||
--
|
||||
@@ -327,3 +367,24 @@ return _ d = d.return
|
||||
bind : (M : Type -> Type) -> Monad M
|
||||
-> (A : Type) -> (B : Type) -> M A -> (A -> M B) -> M B
|
||||
bind _ d = d.bind
|
||||
|
||||
-- Operators:
|
||||
|
||||
{-
|
||||
(x >>= y) => bind ? ? ? ? x y
|
||||
(x >> y) => bind ? ? ? ? x (\_ -> y)
|
||||
-}
|
||||
|
||||
-- Instances:
|
||||
|
||||
monad_List : Monad List
|
||||
monad_list = rec return = \A -> \x -> Cons A x (Nil A)
|
||||
bind = \A -> \B -> \m -> \k -> concat B (map A B k m)
|
||||
|
||||
monad_Maybe : Monad Maybe
|
||||
monad_Maybe =
|
||||
rec return = Just
|
||||
bind = \A -> \B -> \m -> \k ->
|
||||
case m of
|
||||
Nothing _ -> Nothing B
|
||||
Just _ x -> k x
|
||||
|
||||
Reference in New Issue
Block a user