1
0
forked from GitHub/gf-core

Use rec and sig for records.

This commit is contained in:
bringert
2005-11-29 18:16:33 +00:00
parent 2ebf7da067
commit bb5f9dc312
22 changed files with 364 additions and 358 deletions

View File

@@ -22,12 +22,12 @@ data Exp_
type Exp = Tree Exp_
data LetDef_
type LetDef = Tree LetDef_
data Case_
type Case = Tree Case_
data FieldType_
type FieldType = Tree FieldType_
data FieldValue_
type FieldValue = Tree FieldValue_
data Case_
type Case = Tree Case_
data TMeta_
type TMeta = Tree TMeta_
data CIdent_
@@ -54,7 +54,6 @@ data Tree :: * -> * where
EPi :: PatternVariable -> Exp -> Exp -> Tree Exp_
EApp :: Exp -> Exp -> Tree Exp_
EProj :: Exp -> CIdent -> Tree Exp_
EEmptyRec :: Tree Exp_
ERecType :: [FieldType] -> Tree Exp_
ERec :: [FieldValue] -> Tree Exp_
EVar :: CIdent -> Tree Exp_
@@ -63,9 +62,9 @@ data Tree :: * -> * where
EInt :: Integer -> Tree Exp_
EMeta :: TMeta -> Tree Exp_
LetDef :: CIdent -> Exp -> Exp -> Tree LetDef_
Case :: Pattern -> Exp -> Tree Case_
FieldType :: CIdent -> Exp -> Tree FieldType_
FieldValue :: CIdent -> Exp -> Tree FieldValue_
Case :: Pattern -> Exp -> Tree Case_
TMeta :: String -> Tree TMeta_
CIdent :: String -> Tree CIdent_
@@ -104,9 +103,9 @@ composOpM f t = case t of
EVar cident -> return EVar `ap` f cident
EMeta tmeta -> return EMeta `ap` f tmeta
LetDef cident exp0 exp1 -> return LetDef `ap` f cident `ap` f exp0 `ap` f exp1
Case pattern exp -> return Case `ap` f pattern `ap` f exp
FieldType cident exp -> return FieldType `ap` f cident `ap` f exp
FieldValue cident exp -> return FieldValue `ap` f cident `ap` f exp
Case pattern exp -> return Case `ap` f pattern `ap` f exp
_ -> return t
composOpFold :: b -> (b -> b -> b) -> (forall a. Tree a -> b) -> Tree c -> b
@@ -132,9 +131,9 @@ composOpFold zero combine f t = case t of
EVar cident -> f cident
EMeta tmeta -> f tmeta
LetDef cident exp0 exp1 -> f cident `combine` f exp0 `combine` f exp1
Case pattern exp -> f pattern `combine` f exp
FieldType cident exp -> f cident `combine` f exp
FieldValue cident exp -> f cident `combine` f exp
Case pattern exp -> f pattern `combine` f exp
_ -> zero
instance Show (Tree c) where
@@ -159,7 +158,6 @@ instance Show (Tree c) where
EPi patternvariable exp0 exp1 -> opar n . showString "EPi" . showChar ' ' . showsPrec 1 patternvariable . showChar ' ' . showsPrec 1 exp0 . showChar ' ' . showsPrec 1 exp1 . cpar n
EApp exp0 exp1 -> opar n . showString "EApp" . showChar ' ' . showsPrec 1 exp0 . showChar ' ' . showsPrec 1 exp1 . cpar n
EProj exp cident -> opar n . showString "EProj" . showChar ' ' . showsPrec 1 exp . showChar ' ' . showsPrec 1 cident . cpar n
EEmptyRec -> showString "EEmptyRec"
ERecType fieldtypes -> opar n . showString "ERecType" . showChar ' ' . showsPrec 1 fieldtypes . cpar n
ERec fieldvalues -> opar n . showString "ERec" . showChar ' ' . showsPrec 1 fieldvalues . cpar n
EVar cident -> opar n . showString "EVar" . showChar ' ' . showsPrec 1 cident . cpar n
@@ -168,9 +166,9 @@ instance Show (Tree c) where
EInt n -> opar n . showString "EInt" . showChar ' ' . showsPrec 1 n . cpar n
EMeta tmeta -> opar n . showString "EMeta" . showChar ' ' . showsPrec 1 tmeta . cpar n
LetDef cident exp0 exp1 -> opar n . showString "LetDef" . showChar ' ' . showsPrec 1 cident . 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
FieldType cident exp -> opar n . showString "FieldType" . showChar ' ' . showsPrec 1 cident . showChar ' ' . showsPrec 1 exp . cpar n
FieldValue cident exp -> opar n . showString "FieldValue" . showChar ' ' . showsPrec 1 cident . showChar ' ' . showsPrec 1 exp . cpar n
Case pattern exp -> opar n . showString "Case" . showChar ' ' . showsPrec 1 pattern . showChar ' ' . showsPrec 1 exp . cpar n
TMeta str -> opar n . showString "TMeta" . showChar ' ' . showsPrec 1 str . cpar n
CIdent str -> opar n . showString "CIdent" . showChar ' ' . showsPrec 1 str . cpar n
where opar n = if n > 0 then showChar '(' else id
@@ -199,7 +197,6 @@ johnMajorEq (EAbs patternvariable exp) (EAbs patternvariable_ exp_) = patternvar
johnMajorEq (EPi patternvariable exp0 exp1) (EPi patternvariable_ exp0_ exp1_) = patternvariable == patternvariable_ && exp0 == exp0_ && exp1 == exp1_
johnMajorEq (EApp exp0 exp1) (EApp exp0_ exp1_) = exp0 == exp0_ && exp1 == exp1_
johnMajorEq (EProj exp cident) (EProj exp_ cident_) = exp == exp_ && cident == cident_
johnMajorEq EEmptyRec EEmptyRec = True
johnMajorEq (ERecType fieldtypes) (ERecType fieldtypes_) = fieldtypes == fieldtypes_
johnMajorEq (ERec fieldvalues) (ERec fieldvalues_) = fieldvalues == fieldvalues_
johnMajorEq (EVar cident) (EVar cident_) = cident == cident_
@@ -208,9 +205,9 @@ johnMajorEq (EStr str) (EStr str_) = str == str_
johnMajorEq (EInt n) (EInt n_) = n == n_
johnMajorEq (EMeta tmeta) (EMeta tmeta_) = tmeta == tmeta_
johnMajorEq (LetDef cident exp0 exp1) (LetDef cident_ exp0_ exp1_) = cident == cident_ && exp0 == exp0_ && exp1 == exp1_
johnMajorEq (Case pattern exp) (Case pattern_ exp_) = pattern == pattern_ && exp == exp_
johnMajorEq (FieldType cident exp) (FieldType cident_ exp_) = cident == cident_ && exp == exp_
johnMajorEq (FieldValue cident exp) (FieldValue cident_ exp_) = cident == cident_ && exp == exp_
johnMajorEq (Case pattern exp) (Case pattern_ exp_) = pattern == pattern_ && exp == exp_
johnMajorEq (TMeta str) (TMeta str_) = str == str_
johnMajorEq (CIdent str) (CIdent str_) = str == str_
johnMajorEq _ _ = False
@@ -238,20 +235,19 @@ instance Ord (Tree c) where
index (EPi _ _ _) = 17
index (EApp _ _) = 18
index (EProj _ _) = 19
index (EEmptyRec ) = 20
index (ERecType _) = 21
index (ERec _) = 22
index (EVar _) = 23
index (EType ) = 24
index (EStr _) = 25
index (EInt _) = 26
index (EMeta _) = 27
index (LetDef _ _ _) = 28
index (Case _ _) = 29
index (FieldType _ _) = 30
index (FieldValue _ _) = 31
index (TMeta _) = 32
index (CIdent _) = 33
index (ERecType _) = 20
index (ERec _) = 21
index (EVar _) = 22
index (EType ) = 23
index (EStr _) = 24
index (EInt _) = 25
index (EMeta _) = 26
index (LetDef _ _ _) = 27
index (FieldType _ _) = 28
index (FieldValue _ _) = 29
index (Case _ _) = 30
index (TMeta _) = 31
index (CIdent _) = 32
compareSame (Module decls) (Module decls_) = compare decls decls_
compareSame (DataDecl cident exp consdecls) (DataDecl cident_ exp_ consdecls_) = mappend (compare cident cident_) (mappend (compare exp exp_) (compare consdecls consdecls_))
compareSame (TypeDecl cident exp) (TypeDecl cident_ exp_) = mappend (compare cident cident_) (compare exp exp_)
@@ -272,7 +268,6 @@ instance Ord (Tree c) where
compareSame (EPi patternvariable exp0 exp1) (EPi patternvariable_ exp0_ exp1_) = mappend (compare patternvariable patternvariable_) (mappend (compare exp0 exp0_) (compare exp1 exp1_))
compareSame (EApp exp0 exp1) (EApp exp0_ exp1_) = mappend (compare exp0 exp0_) (compare exp1 exp1_)
compareSame (EProj exp cident) (EProj exp_ cident_) = mappend (compare exp exp_) (compare cident cident_)
compareSame EEmptyRec EEmptyRec = EQ
compareSame (ERecType fieldtypes) (ERecType fieldtypes_) = compare fieldtypes fieldtypes_
compareSame (ERec fieldvalues) (ERec fieldvalues_) = compare fieldvalues fieldvalues_
compareSame (EVar cident) (EVar cident_) = compare cident cident_
@@ -281,9 +276,9 @@ instance Ord (Tree c) where
compareSame (EInt n) (EInt n_) = compare n n_
compareSame (EMeta tmeta) (EMeta tmeta_) = compare tmeta tmeta_
compareSame (LetDef cident exp0 exp1) (LetDef cident_ exp0_ exp1_) = mappend (compare cident cident_) (mappend (compare exp0 exp0_) (compare exp1 exp1_))
compareSame (Case pattern exp) (Case pattern_ exp_) = mappend (compare pattern pattern_) (compare exp exp_)
compareSame (FieldType cident exp) (FieldType cident_ exp_) = mappend (compare cident cident_) (compare exp exp_)
compareSame (FieldValue cident exp) (FieldValue cident_ exp_) = mappend (compare cident cident_) (compare exp exp_)
compareSame (Case pattern exp) (Case pattern_ exp_) = mappend (compare pattern pattern_) (compare exp exp_)
compareSame (TMeta str) (TMeta str_) = compare str str_
compareSame (CIdent str) (CIdent str_) = compare str str_
compareSame x y = error "BNFC error:" compareSame

View File

@@ -24,7 +24,7 @@ PCons. Pattern ::= "(" CIdent [Pattern] ")" ;
-- constructor patterns must have parantheses.
PVar. Pattern ::= PatternVariable ;
-- Record patterns.
PRec. Pattern ::= "{" [FieldPattern] "}";
PRec. Pattern ::= "rec" "{" [FieldPattern] "}";
-- Patterns matching the constant Type.
PType. Pattern ::= "Type" ;
-- String literal patterns.
@@ -59,11 +59,17 @@ EApp. Exp3 ::= Exp3 Exp4 ;
-- Record field projection.
EProj. Exp4 ::= Exp4 "." CIdent ;
EEmptyRec. Exp5 ::= "{" "}" ;
-- Record types.
ERecType. Exp5 ::= "{" [FieldType] "}" ;
ERecType. Exp5 ::= "sig" "{" [FieldType] "}" ;
FieldType. FieldType ::= CIdent ":" Exp ;
separator FieldType ";" ;
-- Record expressions.
ERec. Exp5 ::= "{" [FieldValue] "}" ;
ERec. Exp5 ::= "rec" "{" [FieldValue] "}" ;
FieldValue.FieldValue ::= CIdent "=" Exp ;
separator FieldValue ";" ;
-- Functions, constructors and local variables.
EVar. Exp5 ::= CIdent ;
-- The constant Type.
@@ -79,24 +85,11 @@ token TMeta ('?' digit+) ;
coercions Exp 5 ;
{-
-- Hack to make lists of function arguments not conflict with
-- application.
[]. [Exp] ::= ;
(:). [Exp] ::= Exp4 [Exp] ;
-}
Case. Case ::= Pattern "->" Exp ;
separator Case ";" ;
FieldType. FieldType ::= CIdent ":" Exp ;
separator nonempty FieldType ";" ;
FieldValue. FieldValue ::= CIdent "=" Exp ;
separator nonempty FieldValue ";" ;
-- Identifiers in core can start with underscore to allow
-- generating unique identifiers easily.
token CIdent ((letter | '_') (letter | digit | '_' | '\'')*) ;

View File

@@ -50,7 +50,7 @@ The reserved words used in Core are the following: \\
\begin{tabular}{lll}
{\reserved{Type}} &{\reserved{case}} &{\reserved{data}} \\
{\reserved{in}} &{\reserved{let}} &{\reserved{of}} \\
{\reserved{where}} & & \\
{\reserved{rec}} &{\reserved{sig}} &{\reserved{where}} \\
\end{tabular}\\
The symbols used in Core are the following: \\
@@ -105,7 +105,7 @@ All other symbols are terminals.\\
\begin{tabular}{lll}
{\nonterminal{Pattern}} & {\arrow} &{\terminal{(}} {\nonterminal{CIdent}} {\nonterminal{ListPattern}} {\terminal{)}} \\
& {\delimit} &{\nonterminal{PatternVariable}} \\
& {\delimit} &{\terminal{\{}} {\nonterminal{ListFieldPattern}} {\terminal{\}}} \\
& {\delimit} &{\terminal{rec}} {\terminal{\{}} {\nonterminal{ListFieldPattern}} {\terminal{\}}} \\
& {\delimit} &{\terminal{Type}} \\
& {\delimit} &{\nonterminal{String}} \\
& {\delimit} &{\nonterminal{Integer}} \\
@@ -159,9 +159,8 @@ All other symbols are terminals.\\
\end{tabular}\\
\begin{tabular}{lll}
{\nonterminal{Exp5}} & {\arrow} &{\terminal{\{}} {\terminal{\}}} \\
& {\delimit} &{\terminal{\{}} {\nonterminal{ListFieldType}} {\terminal{\}}} \\
& {\delimit} &{\terminal{\{}} {\nonterminal{ListFieldValue}} {\terminal{\}}} \\
{\nonterminal{Exp5}} & {\arrow} &{\terminal{sig}} {\terminal{\{}} {\nonterminal{ListFieldType}} {\terminal{\}}} \\
& {\delimit} &{\terminal{rec}} {\terminal{\{}} {\nonterminal{ListFieldValue}} {\terminal{\}}} \\
& {\delimit} &{\nonterminal{CIdent}} \\
& {\delimit} &{\terminal{Type}} \\
& {\delimit} &{\nonterminal{String}} \\
@@ -170,6 +169,26 @@ All other symbols are terminals.\\
& {\delimit} &{\terminal{(}} {\nonterminal{Exp}} {\terminal{)}} \\
\end{tabular}\\
\begin{tabular}{lll}
{\nonterminal{FieldType}} & {\arrow} &{\nonterminal{CIdent}} {\terminal{:}} {\nonterminal{Exp}} \\
\end{tabular}\\
\begin{tabular}{lll}
{\nonterminal{ListFieldType}} & {\arrow} &{\emptyP} \\
& {\delimit} &{\nonterminal{FieldType}} \\
& {\delimit} &{\nonterminal{FieldType}} {\terminal{;}} {\nonterminal{ListFieldType}} \\
\end{tabular}\\
\begin{tabular}{lll}
{\nonterminal{FieldValue}} & {\arrow} &{\nonterminal{CIdent}} {\terminal{{$=$}}} {\nonterminal{Exp}} \\
\end{tabular}\\
\begin{tabular}{lll}
{\nonterminal{ListFieldValue}} & {\arrow} &{\emptyP} \\
& {\delimit} &{\nonterminal{FieldValue}} \\
& {\delimit} &{\nonterminal{FieldValue}} {\terminal{;}} {\nonterminal{ListFieldValue}} \\
\end{tabular}\\
\begin{tabular}{lll}
{\nonterminal{Exp1}} & {\arrow} &{\nonterminal{Exp2}} \\
\end{tabular}\\
@@ -184,24 +203,6 @@ All other symbols are terminals.\\
& {\delimit} &{\nonterminal{Case}} {\terminal{;}} {\nonterminal{ListCase}} \\
\end{tabular}\\
\begin{tabular}{lll}
{\nonterminal{FieldType}} & {\arrow} &{\nonterminal{CIdent}} {\terminal{:}} {\nonterminal{Exp}} \\
\end{tabular}\\
\begin{tabular}{lll}
{\nonterminal{ListFieldType}} & {\arrow} &{\nonterminal{FieldType}} \\
& {\delimit} &{\nonterminal{FieldType}} {\terminal{;}} {\nonterminal{ListFieldType}} \\
\end{tabular}\\
\begin{tabular}{lll}
{\nonterminal{FieldValue}} & {\arrow} &{\nonterminal{CIdent}} {\terminal{{$=$}}} {\nonterminal{Exp}} \\
\end{tabular}\\
\begin{tabular}{lll}
{\nonterminal{ListFieldValue}} & {\arrow} &{\nonterminal{FieldValue}} \\
& {\delimit} &{\nonterminal{FieldValue}} {\terminal{;}} {\nonterminal{ListFieldValue}} \\
\end{tabular}\\
\end{document}

View File

@@ -88,7 +88,7 @@ eitherResIdent tv s = treeFind resWords
| s > a = treeFind right
| s == a = t
resWords = b "in" (b "case" (b "Type" N N) (b "data" N N)) (b "of" (b "let" N N) (b "where" N N))
resWords = b "let" (b "data" (b "case" (b "Type" N N) N) (b "in" N N)) (b "sig" (b "rec" (b "of" N N) N) (b "where" N N))
where b s = B s (TS s)
unescapeInitTail :: String -> String

View File

@@ -85,7 +85,7 @@ eitherResIdent tv s = treeFind resWords
| s > a = treeFind right
| s == a = t
resWords = b "in" (b "case" (b "Type" N N) (b "data" N N)) (b "of" (b "let" N N) (b "where" N N))
resWords = b "let" (b "data" (b "case" (b "Type" N N) N) (b "in" N N)) (b "sig" (b "rec" (b "of" N N) N) (b "where" N N))
where b s = B s (TS s)
unescapeInitTail :: String -> String

View File

@@ -139,46 +139,46 @@ happyIn25 x = unsafeCoerce# x
happyOut25 :: (HappyAbsSyn ) -> (Exp)
happyOut25 x = unsafeCoerce# x
{-# INLINE happyOut25 #-}
happyIn26 :: (Exp) -> (HappyAbsSyn )
happyIn26 :: (FieldType) -> (HappyAbsSyn )
happyIn26 x = unsafeCoerce# x
{-# INLINE happyIn26 #-}
happyOut26 :: (HappyAbsSyn ) -> (Exp)
happyOut26 :: (HappyAbsSyn ) -> (FieldType)
happyOut26 x = unsafeCoerce# x
{-# INLINE happyOut26 #-}
happyIn27 :: (Case) -> (HappyAbsSyn )
happyIn27 :: ([FieldType]) -> (HappyAbsSyn )
happyIn27 x = unsafeCoerce# x
{-# INLINE happyIn27 #-}
happyOut27 :: (HappyAbsSyn ) -> (Case)
happyOut27 :: (HappyAbsSyn ) -> ([FieldType])
happyOut27 x = unsafeCoerce# x
{-# INLINE happyOut27 #-}
happyIn28 :: ([Case]) -> (HappyAbsSyn )
happyIn28 :: (FieldValue) -> (HappyAbsSyn )
happyIn28 x = unsafeCoerce# x
{-# INLINE happyIn28 #-}
happyOut28 :: (HappyAbsSyn ) -> ([Case])
happyOut28 :: (HappyAbsSyn ) -> (FieldValue)
happyOut28 x = unsafeCoerce# x
{-# INLINE happyOut28 #-}
happyIn29 :: (FieldType) -> (HappyAbsSyn )
happyIn29 :: ([FieldValue]) -> (HappyAbsSyn )
happyIn29 x = unsafeCoerce# x
{-# INLINE happyIn29 #-}
happyOut29 :: (HappyAbsSyn ) -> (FieldType)
happyOut29 :: (HappyAbsSyn ) -> ([FieldValue])
happyOut29 x = unsafeCoerce# x
{-# INLINE happyOut29 #-}
happyIn30 :: ([FieldType]) -> (HappyAbsSyn )
happyIn30 :: (Exp) -> (HappyAbsSyn )
happyIn30 x = unsafeCoerce# x
{-# INLINE happyIn30 #-}
happyOut30 :: (HappyAbsSyn ) -> ([FieldType])
happyOut30 :: (HappyAbsSyn ) -> (Exp)
happyOut30 x = unsafeCoerce# x
{-# INLINE happyOut30 #-}
happyIn31 :: (FieldValue) -> (HappyAbsSyn )
happyIn31 :: (Case) -> (HappyAbsSyn )
happyIn31 x = unsafeCoerce# x
{-# INLINE happyIn31 #-}
happyOut31 :: (HappyAbsSyn ) -> (FieldValue)
happyOut31 :: (HappyAbsSyn ) -> (Case)
happyOut31 x = unsafeCoerce# x
{-# INLINE happyOut31 #-}
happyIn32 :: ([FieldValue]) -> (HappyAbsSyn )
happyIn32 :: ([Case]) -> (HappyAbsSyn )
happyIn32 x = unsafeCoerce# x
{-# INLINE happyIn32 #-}
happyOut32 :: (HappyAbsSyn ) -> ([FieldValue])
happyOut32 :: (HappyAbsSyn ) -> ([Case])
happyOut32 x = unsafeCoerce# x
{-# INLINE happyOut32 #-}
happyInTok :: Token -> (HappyAbsSyn )
@@ -189,21 +189,21 @@ happyOutTok x = unsafeCoerce# x
{-# INLINE happyOutTok #-}
happyActOffsets :: HappyAddr
happyActOffsets = HappyA# "\x3c\x00\x44\x01\xd6\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xce\x00\x00\x00\x86\x01\xd5\x00\x00\x00\x00\x00\xff\xff\x30\x01\xfa\xff\x00\x00\x44\x01\xdc\x00\x00\x00\x00\x00\x00\x00\x6b\x00\xcd\x00\x00\x00\xdd\x00\xc7\x00\xd1\x00\x3c\x00\x44\x01\x44\x01\xb5\x00\xb9\x00\x00\x00\xc8\x00\x00\x00\x58\x01\xc6\x00\xc0\x00\x2f\x00\xc1\x00\xbd\x00\xbe\x00\xbc\x00\x00\x00\x9f\x00\xa9\x00\x44\x01\x00\x00\x00\x00\x97\x00\x00\x00\x97\x00\x44\x01\x44\x01\x00\x00\x44\x01\x44\x01\xa7\x00\xaa\x00\xa8\x00\xa0\x00\x00\x00\x00\x00\x00\x00\x44\x01\x91\x00\x93\x00\x78\x00\x44\x01\x7b\x01\x00\x00\x9a\x00\x00\x00\x00\x00\x95\x00\x00\x00\x86\x00\x00\x00\x8c\x00\x00\x00\x00\x00\x85\x00\x00\x00\x84\x00\x88\x00\x6e\x00\x6e\x00\x00\x00\x81\x00\x00\x00\x44\x01\x80\x00\x63\x00\x00\x00\x44\x01\x00\x00\x73\x00\x70\x00\x6a\x00\x00\x00\x7b\x01\x44\x01\x44\x01\x00\x00\x00\x00\x00\x00\x00\x00\x45\x00\x7b\x01\x6c\x01\x00\x00\x3b\x00\x59\x00\x4f\x00\x00\x00\x21\x00\x44\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"#
happyActOffsets = HappyA# "\x5c\x00\x31\x01\xec\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdb\x00\x00\x00\x57\x01\xf5\x00\x00\x00\x00\x00\x1e\x01\xfb\xff\x00\x00\x31\x01\xef\x00\xea\x00\xe9\x00\x00\x00\x00\x00\x00\x00\x08\x00\xd9\x00\x00\x00\xe4\x00\xd2\x00\xe2\x00\x5c\x00\x31\x01\x31\x01\xcb\x00\xcb\x00\xcb\x00\xc6\x00\x00\x00\xd8\x00\x00\x00\x44\x01\xd3\x00\xcd\x00\xb6\x00\xc4\x00\x31\x01\x00\x00\x00\x00\x31\x01\x31\x01\xc9\x00\xc5\x00\xc3\x00\xc2\x00\xc0\x00\xb8\x00\xb3\x00\xb4\x00\xb0\x00\xac\x00\x00\x00\x00\x00\x00\x00\x31\x01\x95\x00\x00\x00\x96\x00\x31\x01\x00\x00\x96\x00\x31\x01\x98\x00\x90\x00\x31\x01\x5f\x01\x00\x00\x9f\x00\x91\x00\x00\x00\x00\x00\x8f\x00\x00\x00\x97\x00\x79\x00\x63\x00\x00\x00\x77\x00\x70\x00\x00\x00\x31\x01\x00\x00\x00\x00\x00\x00\x00\x00\x6f\x00\x55\x00\x00\x00\x31\x01\x55\x00\x00\x00\x00\x00\x5f\x01\x31\x01\x31\x01\x00\x00\x00\x00\x00\x00\x4c\x01\x67\x00\x6a\x00\x59\x00\x00\x00\x5d\x00\x5b\x00\x53\x00\x00\x00\x3c\x00\x31\x01\x00\x00\x3c\x00\x5f\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"#
happyGotoOffsets :: HappyAddr
happyGotoOffsets = HappyA# "\x62\x00\x1d\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x25\x00\x00\x00\x00\x00\x00\x00\xfe\xff\x2d\x00\x02\x00\x00\x00\x15\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x28\x00\x00\x00\x06\x00\xff\x00\xf7\x00\x39\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1e\x00\x00\x00\xe1\x00\x00\x00\x00\x00\x01\x00\x00\x00\x0b\x00\xd9\x00\xc3\x00\x00\x00\xbb\x00\xa5\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9d\x00\x00\x00\x00\x00\x03\x00\x87\x00\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x44\x00\x17\x00\x00\x00\x00\x00\x00\x00\x7f\x00\x00\x00\x5f\x01\x00\x00\x69\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07\x00\x61\x00\x4b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x27\x00\x48\x01\x34\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x59\x01\x43\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"#
happyGotoOffsets = HappyA# "\x85\x00\x04\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x19\x01\x00\x00\x00\x00\x00\x00\x14\x00\x49\x00\x00\x00\xfb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x4c\x00\x00\x00\x8d\x00\xe6\x00\xdd\x00\x0d\x01\x17\x00\x3e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x2e\x00\x00\x00\xc8\x00\x00\x00\x00\x00\xbf\x00\xaa\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa1\x00\x00\x00\x00\x00\x0e\x00\x8c\x00\x00\x00\x06\x00\x83\x00\x00\x00\x09\x00\x6e\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x65\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x79\x01\x00\x00\x50\x00\x33\x00\xfe\xff\x00\x00\x01\x00\x47\x00\x32\x00\x00\x00\x00\x00\x00\x00\x78\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x77\x01\x29\x00\x00\x00\x2d\x00\x38\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"#
happyDefActions :: HappyAddr
happyDefActions = HappyA# "\xf8\xff\x00\x00\x00\x00\xfd\xff\xcd\xff\xcc\xff\xcb\xff\xcf\xff\x00\x00\xc9\xff\xd7\xff\xd5\xff\xd3\xff\xde\xff\x00\x00\x00\x00\x00\x00\xce\xff\x00\x00\x00\x00\xfc\xff\xfb\xff\xfa\xff\x00\x00\x00\x00\xf9\xff\xf7\xff\x00\x00\x00\x00\xf8\xff\x00\x00\x00\x00\xdc\xff\x00\x00\xe2\xff\x00\x00\xe1\xff\xe2\xff\x00\x00\x00\x00\x00\x00\xc3\xff\x00\x00\xc0\xff\x00\x00\xd2\xff\x00\x00\xd6\xff\x00\x00\xd4\xff\xd0\xff\x00\x00\xd1\xff\x00\x00\x00\x00\x00\x00\xca\xff\x00\x00\x00\x00\x00\x00\x00\x00\xdb\xff\x00\x00\xf3\xff\xf4\xff\xf6\xff\x00\x00\x00\x00\x00\x00\xdc\xff\x00\x00\xc7\xff\xd9\xff\x00\x00\xc1\xff\xc4\xff\x00\x00\xc2\xff\x00\x00\xbf\xff\x00\x00\xe8\xff\xe7\xff\x00\x00\xeb\xff\xc6\xff\x00\x00\xe5\xff\x00\x00\xe9\xff\x00\x00\xda\xff\x00\x00\x00\x00\xf1\xff\xe0\xff\x00\x00\xee\xff\x00\x00\xe4\xff\x00\x00\xdf\xff\xc7\xff\x00\x00\x00\x00\xd8\xff\xc8\xff\xc5\xff\xea\xff\xe5\xff\x00\x00\x00\x00\xdd\xff\x00\x00\xf0\xff\x00\x00\xf5\xff\xf1\xff\x00\x00\xed\xff\xec\xff\xe6\xff\xe3\xff\xf2\xff\xef\xff"#
happyDefActions = HappyA# "\xf8\xff\x00\x00\x00\x00\xfd\xff\xce\xff\xcd\xff\xcc\xff\xd0\xff\x00\x00\xc2\xff\xd7\xff\xd5\xff\xd3\xff\xde\xff\x00\x00\x00\x00\xcf\xff\x00\x00\x00\x00\x00\x00\x00\x00\xfc\xff\xfb\xff\xfa\xff\x00\x00\x00\x00\xf9\xff\xf7\xff\x00\x00\x00\x00\xf8\xff\x00\x00\x00\x00\xc9\xff\xc5\xff\xdc\xff\x00\x00\xe2\xff\x00\x00\xe1\xff\xe2\xff\x00\x00\x00\x00\x00\x00\xd6\xff\x00\x00\xd4\xff\xcb\xff\x00\x00\x00\x00\x00\x00\x00\x00\xdb\xff\x00\x00\x00\x00\xc4\xff\x00\x00\x00\x00\xc8\xff\x00\x00\xf3\xff\xf4\xff\xf6\xff\x00\x00\x00\x00\xd2\xff\xc9\xff\x00\x00\xd1\xff\xc5\xff\x00\x00\x00\x00\xdc\xff\x00\x00\xc0\xff\xd9\xff\x00\x00\x00\x00\xe8\xff\xe7\xff\x00\x00\xeb\xff\xbf\xff\x00\x00\x00\x00\xe9\xff\x00\x00\x00\x00\xda\xff\x00\x00\xc6\xff\xc3\xff\xca\xff\xc7\xff\x00\x00\xf1\xff\xe0\xff\x00\x00\xe5\xff\xee\xff\xdf\xff\xc0\xff\x00\x00\x00\x00\xd8\xff\xc1\xff\xbe\xff\x00\x00\x00\x00\xe4\xff\x00\x00\xdd\xff\x00\x00\xf0\xff\x00\x00\xf5\xff\xf1\xff\x00\x00\xea\xff\xe5\xff\x00\x00\xed\xff\xec\xff\xe6\xff\xe3\xff\xf2\xff\xef\xff"#
happyCheck :: HappyAddr
happyCheck = HappyA# "\xff\xff\x03\x00\x08\x00\x04\x00\x03\x00\x03\x00\x03\x00\x00\x00\x01\x00\x03\x00\x03\x00\x05\x00\x06\x00\x09\x00\x03\x00\x0d\x00\x16\x00\x0a\x00\x0f\x00\x10\x00\x0d\x00\x16\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x03\x00\x1a\x00\x1b\x00\x16\x00\x17\x00\x00\x00\x01\x00\x03\x00\x03\x00\x18\x00\x19\x00\x00\x00\x01\x00\x02\x00\x03\x00\x0a\x00\x03\x00\x03\x00\x0d\x00\x00\x00\x01\x00\x02\x00\x03\x00\x02\x00\x0b\x00\x0c\x00\x05\x00\x16\x00\x17\x00\x16\x00\x13\x00\x14\x00\x0d\x00\x0e\x00\x03\x00\x02\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x00\x00\x01\x00\x02\x00\x03\x00\x03\x00\x0f\x00\x10\x00\x0e\x00\x00\x00\x01\x00\x02\x00\x03\x00\x0b\x00\x0c\x00\x0e\x00\x16\x00\x04\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x0e\x00\x01\x00\x16\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x00\x00\x01\x00\x02\x00\x03\x00\x03\x00\x04\x00\x05\x00\x06\x00\x00\x00\x01\x00\x02\x00\x03\x00\x02\x00\x04\x00\x0e\x00\x05\x00\x01\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x0e\x00\x05\x00\x16\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x00\x00\x01\x00\x02\x00\x03\x00\x03\x00\x16\x00\x01\x00\x05\x00\x00\x00\x01\x00\x02\x00\x03\x00\x05\x00\x04\x00\x0e\x00\x16\x00\x0a\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x0e\x00\x0a\x00\x02\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x00\x00\x01\x00\x02\x00\x03\x00\x07\x00\x0f\x00\x12\x00\x04\x00\x00\x00\x01\x00\x02\x00\x03\x00\x01\x00\x03\x00\x0e\x00\x02\x00\x16\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x0e\x00\x0b\x00\x16\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x00\x00\x01\x00\x02\x00\x03\x00\x01\x00\x04\x00\x04\x00\x01\x00\x00\x00\x01\x00\x02\x00\x03\x00\x07\x00\x02\x00\x0e\x00\x11\x00\x16\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x0e\x00\x0a\x00\x02\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x00\x00\x01\x00\x02\x00\x03\x00\x16\x00\x01\x00\x03\x00\x0b\x00\x00\x00\x01\x00\x02\x00\x03\x00\x18\x00\x18\x00\x0e\x00\xff\xff\x13\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x0e\x00\xff\xff\xff\xff\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x00\x00\x01\x00\x02\x00\x03\x00\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x01\x00\x02\x00\x03\x00\xff\xff\xff\xff\x0e\x00\xff\xff\xff\xff\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x0e\x00\xff\xff\xff\xff\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x00\x00\x01\x00\x02\x00\x03\x00\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x01\x00\x02\x00\x03\x00\xff\xff\xff\xff\x0e\x00\xff\xff\xff\xff\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x0e\x00\xff\xff\xff\xff\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x03\x00\x00\x00\x01\x00\x06\x00\x03\x00\x08\x00\x09\x00\xff\xff\xff\xff\x0c\x00\x0d\x00\x0a\x00\xff\xff\x10\x00\x0d\x00\xff\xff\x13\x00\x14\x00\x15\x00\x16\x00\x03\x00\x00\x00\x01\x00\x06\x00\x03\x00\xff\xff\x09\x00\xff\xff\xff\xff\x0c\x00\x0d\x00\x0a\x00\xff\xff\x10\x00\x0d\x00\xff\xff\x13\x00\x14\x00\x15\x00\x16\x00\x03\x00\x03\x00\xff\xff\x06\x00\x07\x00\x07\x00\x08\x00\x03\x00\x0b\x00\x0c\x00\xff\xff\x07\x00\x08\x00\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\x16\x00\x03\x00\xff\xff\xff\xff\x06\x00\x07\x00\x08\x00\xff\xff\xff\xff\xff\xff\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x03\x00\x13\x00\x14\x00\x06\x00\x16\x00\x08\x00\xff\xff\xff\xff\xff\xff\x0c\x00\xff\xff\x03\x00\xff\xff\xff\xff\x06\x00\xff\xff\x13\x00\x14\x00\xff\xff\x16\x00\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\x15\x00\x16\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"#
happyCheck = HappyA# "\xff\xff\x00\x00\x01\x00\x08\x00\x03\x00\x00\x00\x01\x00\x09\x00\x03\x00\x03\x00\x02\x00\x0a\x00\x03\x00\x05\x00\x0d\x00\x0a\x00\x03\x00\x03\x00\x0d\x00\x18\x00\x00\x00\x01\x00\x02\x00\x03\x00\x0f\x00\x10\x00\x03\x00\x1a\x00\x1b\x00\x17\x00\x18\x00\x1a\x00\x1b\x00\x0d\x00\x0e\x00\x15\x00\x16\x00\x11\x00\x12\x00\x13\x00\x14\x00\x00\x00\x01\x00\x02\x00\x03\x00\x19\x00\x17\x00\x18\x00\x03\x00\x03\x00\x00\x00\x01\x00\x02\x00\x03\x00\x03\x00\x0e\x00\x0b\x00\x0c\x00\x11\x00\x12\x00\x13\x00\x14\x00\x0b\x00\x0c\x00\x0e\x00\x03\x00\x19\x00\x11\x00\x12\x00\x13\x00\x14\x00\x00\x00\x01\x00\x02\x00\x03\x00\x19\x00\x03\x00\x0f\x00\x10\x00\x03\x00\x00\x00\x01\x00\x02\x00\x03\x00\x18\x00\x0e\x00\x0d\x00\x04\x00\x11\x00\x12\x00\x13\x00\x14\x00\x01\x00\x04\x00\x0e\x00\x02\x00\x19\x00\x11\x00\x12\x00\x13\x00\x14\x00\x00\x00\x01\x00\x02\x00\x03\x00\x19\x00\x0e\x00\x01\x00\x05\x00\x18\x00\x00\x00\x01\x00\x02\x00\x03\x00\x03\x00\x0e\x00\x18\x00\x05\x00\x11\x00\x12\x00\x13\x00\x14\x00\x03\x00\x18\x00\x0e\x00\x04\x00\x19\x00\x11\x00\x12\x00\x13\x00\x14\x00\x00\x00\x01\x00\x02\x00\x03\x00\x19\x00\x03\x00\x04\x00\x05\x00\x06\x00\x00\x00\x01\x00\x02\x00\x03\x00\x03\x00\x0e\x00\x05\x00\x06\x00\x11\x00\x12\x00\x13\x00\x14\x00\x01\x00\x0a\x00\x0e\x00\x0a\x00\x19\x00\x11\x00\x12\x00\x13\x00\x14\x00\x00\x00\x01\x00\x02\x00\x03\x00\x19\x00\x07\x00\x0f\x00\x18\x00\x14\x00\x00\x00\x01\x00\x02\x00\x03\x00\x18\x00\x0e\x00\x04\x00\x01\x00\x11\x00\x12\x00\x13\x00\x14\x00\x02\x00\x04\x00\x0e\x00\x01\x00\x19\x00\x11\x00\x12\x00\x13\x00\x14\x00\x00\x00\x01\x00\x02\x00\x03\x00\x19\x00\x01\x00\x05\x00\x04\x00\x02\x00\x00\x00\x01\x00\x02\x00\x03\x00\x03\x00\x0e\x00\x18\x00\x0b\x00\x11\x00\x12\x00\x13\x00\x14\x00\x07\x00\x02\x00\x0e\x00\x11\x00\x19\x00\x11\x00\x12\x00\x13\x00\x14\x00\x00\x00\x01\x00\x02\x00\x03\x00\x19\x00\x0a\x00\x18\x00\x02\x00\x01\x00\x00\x00\x01\x00\x02\x00\x03\x00\x18\x00\x0e\x00\x03\x00\x03\x00\x11\x00\x12\x00\x13\x00\x14\x00\x03\x00\x1a\x00\x0e\x00\x1a\x00\x19\x00\x11\x00\x12\x00\x13\x00\x14\x00\x00\x00\x01\x00\x02\x00\x03\x00\x19\x00\x0b\x00\x15\x00\xff\xff\xff\xff\x00\x00\x01\x00\x02\x00\x03\x00\xff\xff\x0e\x00\xff\xff\xff\xff\x11\x00\x12\x00\x13\x00\x14\x00\x03\x00\xff\xff\x0e\x00\xff\xff\x19\x00\x11\x00\x12\x00\x13\x00\x14\x00\x00\x00\x01\x00\x02\x00\x03\x00\x19\x00\xff\xff\xff\xff\xff\xff\xff\xff\x15\x00\x16\x00\x06\x00\xff\xff\x08\x00\x09\x00\xff\xff\xff\xff\x0c\x00\x0d\x00\x13\x00\x14\x00\x10\x00\xff\xff\x12\x00\x13\x00\xff\xff\x15\x00\x16\x00\x17\x00\x18\x00\x06\x00\x00\x00\x01\x00\x09\x00\x03\x00\xff\xff\x0c\x00\x0d\x00\xff\xff\xff\xff\x10\x00\x0a\x00\x12\x00\x13\x00\x0d\x00\x15\x00\x16\x00\x17\x00\x18\x00\x06\x00\x07\x00\xff\xff\xff\xff\xff\xff\x0b\x00\x0c\x00\xff\xff\x06\x00\x07\x00\x08\x00\xff\xff\x12\x00\x13\x00\x0c\x00\x15\x00\x16\x00\x17\x00\x18\x00\x06\x00\x12\x00\xff\xff\xff\xff\x15\x00\x16\x00\x0c\x00\x18\x00\x06\x00\xff\xff\x08\x00\xff\xff\x12\x00\x13\x00\x0c\x00\x15\x00\x16\x00\x17\x00\x18\x00\xff\xff\x12\x00\xff\xff\xff\xff\x15\x00\x16\x00\xff\xff\x18\x00\x00\x00\x01\x00\x03\x00\x03\x00\x03\x00\xff\xff\x07\x00\x08\x00\x07\x00\x08\x00\x0a\x00\xff\xff\xff\xff\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"#
happyTable :: HappyAddr
happyTable = HappyA# "\x00\x00\x28\x00\x25\x00\x2e\x00\x4e\x00\x22\x00\x3c\x00\x51\x00\x52\x00\x17\x00\x22\x00\x41\x00\x1a\x00\x6f\x00\x4c\x00\x23\x00\x17\x00\x53\x00\x3d\x00\x5b\x00\x54\x00\x17\x00\x29\x00\x2a\x00\x2b\x00\x2c\x00\x61\x00\x2b\x00\x4f\x00\x55\x00\x6b\x00\x51\x00\x52\x00\x31\x00\x22\x00\x29\x00\x4d\x00\x04\x00\x05\x00\x06\x00\x07\x00\x53\x00\x62\x00\x1c\x00\x54\x00\x04\x00\x05\x00\x06\x00\x25\x00\x37\x00\x63\x00\x7a\x00\x38\x00\x55\x00\x56\x00\x17\x00\x2f\x00\x0c\x00\x26\x00\x27\x00\x3c\x00\x77\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x04\x00\x05\x00\x06\x00\x07\x00\x62\x00\x3d\x00\x3e\x00\x1c\x00\x04\x00\x05\x00\x06\x00\x07\x00\x63\x00\x64\x00\x7b\x00\x17\x00\x75\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x69\x00\x76\x00\x17\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x04\x00\x05\x00\x06\x00\x07\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x04\x00\x05\x00\x06\x00\x07\x00\x1f\x00\x6d\x00\x6a\x00\x20\x00\x6e\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x70\x00\x6f\x00\x17\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x04\x00\x05\x00\x06\x00\x07\x00\x5f\x00\x17\x00\x67\x00\x61\x00\x04\x00\x05\x00\x06\x00\x07\x00\x38\x00\x66\x00\x5f\x00\x17\x00\x68\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x5a\x00\x69\x00\x37\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x04\x00\x05\x00\x06\x00\x07\x00\x51\x00\x5d\x00\x5e\x00\x45\x00\x04\x00\x05\x00\x06\x00\x07\x00\x46\x00\x48\x00\x43\x00\x47\x00\x17\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x48\x00\x2f\x00\x17\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x04\x00\x05\x00\x06\x00\x07\x00\x34\x00\x33\x00\x35\x00\x36\x00\x04\x00\x05\x00\x06\x00\x07\x00\x39\x00\x3a\x00\x49\x00\x3c\x00\x17\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x4a\x00\x3b\x00\x43\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x04\x00\x05\x00\x06\x00\x07\x00\x17\x00\x1e\x00\x21\x00\x2f\x00\x04\x00\x05\x00\x06\x00\x07\x00\xff\xff\xff\xff\x4b\x00\x00\x00\x04\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x27\x00\x00\x00\x00\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x04\x00\x05\x00\x06\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x05\x00\x06\x00\x07\x00\x00\x00\x00\x00\x3f\x00\x00\x00\x00\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x40\x00\x00\x00\x00\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x04\x00\x05\x00\x06\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x05\x00\x06\x00\x07\x00\x00\x00\x00\x00\x21\x00\x00\x00\x00\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x08\x00\x00\x00\x00\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0f\x00\x51\x00\x52\x00\x10\x00\x22\x00\x25\x00\x11\x00\x00\x00\x00\x00\x12\x00\x13\x00\x77\x00\x00\x00\x14\x00\x54\x00\x00\x00\x04\x00\x15\x00\x16\x00\x17\x00\x0f\x00\x51\x00\x52\x00\x10\x00\x22\x00\x00\x00\x11\x00\x00\x00\x00\x00\x12\x00\x13\x00\x79\x00\x00\x00\x14\x00\x54\x00\x00\x00\x04\x00\x15\x00\x16\x00\x17\x00\xcf\xff\x71\x00\x00\x00\xcf\xff\xcf\xff\x72\x00\x7c\x00\x71\x00\xcf\xff\xcf\xff\x00\x00\x72\x00\x73\x00\x00\x00\x00\x00\x00\x00\xcf\xff\xcf\xff\xcf\xff\xcf\xff\x58\x00\x00\x00\x00\x00\x59\x00\x79\x00\x25\x00\x00\x00\x00\x00\x00\x00\x5a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x58\x00\x04\x00\x15\x00\x59\x00\x17\x00\x25\x00\x00\x00\x00\x00\x00\x00\x5a\x00\x00\x00\x0f\x00\x00\x00\x00\x00\x31\x00\x00\x00\x04\x00\x15\x00\x00\x00\x17\x00\x12\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x15\x00\x16\x00\x17\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"#
happyTable = HappyA# "\x00\x00\x4e\x00\x4f\x00\x28\x00\x25\x00\x4e\x00\x4f\x00\x6b\x00\x25\x00\x36\x00\x20\x00\x50\x00\x33\x00\x21\x00\x51\x00\x50\x00\x63\x00\x39\x00\x51\x00\x18\x00\x04\x00\x05\x00\x06\x00\x28\x00\x34\x00\x58\x00\x36\x00\x52\x00\x6a\x00\x37\x00\x5b\x00\x52\x00\x53\x00\x29\x00\x2a\x00\x3a\x00\x5d\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x04\x00\x05\x00\x06\x00\x07\x00\x0d\x00\x37\x00\x38\x00\x6c\x00\x2e\x00\x04\x00\x05\x00\x06\x00\x07\x00\x6c\x00\x7d\x00\x6d\x00\x7c\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x6d\x00\x6e\x00\x68\x00\x33\x00\x0d\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x04\x00\x05\x00\x06\x00\x07\x00\x0d\x00\x25\x00\x34\x00\x35\x00\x1d\x00\x04\x00\x05\x00\x06\x00\x07\x00\x18\x00\x69\x00\x26\x00\x74\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x75\x00\x77\x00\x6f\x00\x76\x00\x0d\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x04\x00\x05\x00\x06\x00\x07\x00\x0d\x00\x1d\x00\x78\x00\x79\x00\x18\x00\x04\x00\x05\x00\x06\x00\x07\x00\x60\x00\x60\x00\x18\x00\x62\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x63\x00\x18\x00\x57\x00\x65\x00\x0d\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x04\x00\x05\x00\x06\x00\x07\x00\x0d\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x04\x00\x05\x00\x06\x00\x07\x00\x18\x00\x5a\x00\x3e\x00\x1b\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x66\x00\x67\x00\x5c\x00\x68\x00\x0d\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x04\x00\x05\x00\x06\x00\x07\x00\x0d\x00\x4e\x00\x5a\x00\x18\x00\x5f\x00\x04\x00\x05\x00\x06\x00\x07\x00\x18\x00\x40\x00\x42\x00\x43\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x44\x00\x45\x00\x4b\x00\x46\x00\x0d\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x04\x00\x05\x00\x06\x00\x07\x00\x0d\x00\x49\x00\x47\x00\x48\x00\x4a\x00\x04\x00\x05\x00\x06\x00\x07\x00\x4b\x00\x4c\x00\x18\x00\x2c\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x30\x00\x31\x00\x2a\x00\x33\x00\x0d\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x04\x00\x05\x00\x06\x00\x07\x00\x0d\x00\x32\x00\x18\x00\x40\x00\x1f\x00\x04\x00\x05\x00\x06\x00\x07\x00\x18\x00\x3c\x00\x22\x00\x23\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x24\x00\xff\xff\x3d\x00\xff\xff\x0d\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x04\x00\x05\x00\x06\x00\x07\x00\x0d\x00\x2c\x00\x04\x00\x00\x00\x00\x00\x04\x00\x05\x00\x06\x00\x07\x00\x00\x00\x24\x00\x00\x00\x00\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x39\x00\x00\x00\x08\x00\x00\x00\x0d\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x04\x00\x05\x00\x06\x00\x07\x00\x0d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3a\x00\x3b\x00\x0f\x00\x00\x00\x28\x00\x10\x00\x00\x00\x00\x00\x11\x00\x12\x00\x2c\x00\x0c\x00\x13\x00\x00\x00\x14\x00\x15\x00\x00\x00\x04\x00\x16\x00\x17\x00\x18\x00\x0f\x00\x4e\x00\x4f\x00\x10\x00\x25\x00\x00\x00\x11\x00\x12\x00\x00\x00\x00\x00\x13\x00\x7b\x00\x14\x00\x15\x00\x51\x00\x04\x00\x16\x00\x17\x00\x18\x00\xd0\xff\xd0\xff\x00\x00\x00\x00\x00\x00\xd0\xff\xd0\xff\x00\x00\x55\x00\x7b\x00\x28\x00\x00\x00\xd0\xff\xd0\xff\x56\x00\xd0\xff\xd0\xff\xd0\xff\xd0\xff\x2e\x00\x57\x00\x00\x00\x00\x00\x04\x00\x16\x00\x11\x00\x18\x00\x55\x00\x00\x00\x28\x00\x00\x00\x14\x00\x15\x00\x56\x00\x04\x00\x16\x00\x17\x00\x18\x00\x00\x00\x57\x00\x00\x00\x00\x00\x04\x00\x16\x00\x00\x00\x18\x00\x4e\x00\x4f\x00\x70\x00\x25\x00\x70\x00\x00\x00\x71\x00\x7e\x00\x71\x00\x72\x00\x79\x00\x00\x00\x00\x00\x51\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"#
happyReduceArr = array (2, 64) [
happyReduceArr = array (2, 65) [
(2 , happyReduce_2),
(3 , happyReduce_3),
(4 , happyReduce_4),
@@ -266,10 +266,11 @@ happyReduceArr = array (2, 64) [
(61 , happyReduce_61),
(62 , happyReduce_62),
(63 , happyReduce_63),
(64 , happyReduce_64)
(64 , happyReduce_64),
(65 , happyReduce_65)
]
happy_n_terms = 25 :: Int
happy_n_terms = 27 :: Int
happy_n_nonterms = 28 :: Int
happyReduce_2 = happySpecReduce_1 0# happyReduction_2
@@ -431,14 +432,16 @@ happyReduction_20 happy_x_1
(PVar happy_var_1
)}
happyReduce_21 = happySpecReduce_3 10# happyReduction_21
happyReduction_21 happy_x_3
happy_x_2
happy_x_1
= case happyOut17 happy_x_2 of { happy_var_2 ->
happyReduce_21 = happyReduce 4# 10# happyReduction_21
happyReduction_21 (happy_x_4 `HappyStk`
happy_x_3 `HappyStk`
happy_x_2 `HappyStk`
happy_x_1 `HappyStk`
happyRest)
= case happyOut17 happy_x_3 of { happy_var_3 ->
happyIn15
(PRec happy_var_2
)}
(PRec happy_var_3
) `HappyStk` happyRest}
happyReduce_22 = happySpecReduce_1 10# happyReduction_22
happyReduction_22 happy_x_1
@@ -528,14 +531,14 @@ happyReduction_32 (happy_x_6 `HappyStk`
happy_x_1 `HappyStk`
happyRest)
= case happyOut19 happy_x_2 of { happy_var_2 ->
case happyOut28 happy_x_5 of { happy_var_5 ->
case happyOut32 happy_x_5 of { happy_var_5 ->
happyIn19
(ECase happy_var_2 happy_var_5
) `HappyStk` happyRest}}
happyReduce_33 = happySpecReduce_1 14# happyReduction_33
happyReduction_33 happy_x_1
= case happyOut26 happy_x_1 of { happy_var_1 ->
= case happyOut30 happy_x_1 of { happy_var_1 ->
happyIn19
(happy_var_1
)}
@@ -644,67 +647,64 @@ happyReduction_44 happy_x_1
(happy_var_1
)}
happyReduce_45 = happySpecReduce_2 20# happyReduction_45
happyReduction_45 happy_x_2
happy_x_1
= happyIn25
(EEmptyRec
)
happyReduce_46 = happySpecReduce_3 20# happyReduction_46
happyReduction_46 happy_x_3
happy_x_2
happy_x_1
= case happyOut30 happy_x_2 of { happy_var_2 ->
happyReduce_45 = happyReduce 4# 20# happyReduction_45
happyReduction_45 (happy_x_4 `HappyStk`
happy_x_3 `HappyStk`
happy_x_2 `HappyStk`
happy_x_1 `HappyStk`
happyRest)
= case happyOut27 happy_x_3 of { happy_var_3 ->
happyIn25
(ERecType happy_var_2
)}
(ERecType happy_var_3
) `HappyStk` happyRest}
happyReduce_47 = happySpecReduce_3 20# happyReduction_47
happyReduction_47 happy_x_3
happy_x_2
happy_x_1
= case happyOut32 happy_x_2 of { happy_var_2 ->
happyReduce_46 = happyReduce 4# 20# happyReduction_46
happyReduction_46 (happy_x_4 `HappyStk`
happy_x_3 `HappyStk`
happy_x_2 `HappyStk`
happy_x_1 `HappyStk`
happyRest)
= case happyOut29 happy_x_3 of { happy_var_3 ->
happyIn25
(ERec happy_var_2
)}
(ERec happy_var_3
) `HappyStk` happyRest}
happyReduce_48 = happySpecReduce_1 20# happyReduction_48
happyReduction_48 happy_x_1
happyReduce_47 = happySpecReduce_1 20# happyReduction_47
happyReduction_47 happy_x_1
= case happyOut8 happy_x_1 of { happy_var_1 ->
happyIn25
(EVar happy_var_1
)}
happyReduce_49 = happySpecReduce_1 20# happyReduction_49
happyReduction_49 happy_x_1
happyReduce_48 = happySpecReduce_1 20# happyReduction_48
happyReduction_48 happy_x_1
= happyIn25
(EType
)
happyReduce_50 = happySpecReduce_1 20# happyReduction_50
happyReduction_50 happy_x_1
happyReduce_49 = happySpecReduce_1 20# happyReduction_49
happyReduction_49 happy_x_1
= case happyOut5 happy_x_1 of { happy_var_1 ->
happyIn25
(EStr happy_var_1
)}
happyReduce_51 = happySpecReduce_1 20# happyReduction_51
happyReduction_51 happy_x_1
happyReduce_50 = happySpecReduce_1 20# happyReduction_50
happyReduction_50 happy_x_1
= case happyOut6 happy_x_1 of { happy_var_1 ->
happyIn25
(EInt happy_var_1
)}
happyReduce_52 = happySpecReduce_1 20# happyReduction_52
happyReduction_52 happy_x_1
happyReduce_51 = happySpecReduce_1 20# happyReduction_51
happyReduction_51 happy_x_1
= case happyOut7 happy_x_1 of { happy_var_1 ->
happyIn25
(EMeta happy_var_1
)}
happyReduce_53 = happySpecReduce_3 20# happyReduction_53
happyReduction_53 happy_x_3
happyReduce_52 = happySpecReduce_3 20# happyReduction_52
happyReduction_52 happy_x_3
happy_x_2
happy_x_1
= case happyOut19 happy_x_2 of { happy_var_2 ->
@@ -712,91 +712,101 @@ happyReduction_53 happy_x_3
(happy_var_2
)}
happyReduce_54 = happySpecReduce_1 21# happyReduction_54
happyReduction_54 happy_x_1
= case happyOut22 happy_x_1 of { happy_var_1 ->
happyIn26
(happy_var_1
)}
happyReduce_55 = happySpecReduce_3 22# happyReduction_55
happyReduction_55 happy_x_3
happy_x_2
happy_x_1
= case happyOut15 happy_x_1 of { happy_var_1 ->
case happyOut19 happy_x_3 of { happy_var_3 ->
happyIn27
(Case happy_var_1 happy_var_3
)}}
happyReduce_56 = happySpecReduce_0 23# happyReduction_56
happyReduction_56 = happyIn28
([]
)
happyReduce_57 = happySpecReduce_1 23# happyReduction_57
happyReduction_57 happy_x_1
= case happyOut27 happy_x_1 of { happy_var_1 ->
happyIn28
((:[]) happy_var_1
)}
happyReduce_58 = happySpecReduce_3 23# happyReduction_58
happyReduction_58 happy_x_3
happy_x_2
happy_x_1
= case happyOut27 happy_x_1 of { happy_var_1 ->
case happyOut28 happy_x_3 of { happy_var_3 ->
happyIn28
((:) happy_var_1 happy_var_3
)}}
happyReduce_59 = happySpecReduce_3 24# happyReduction_59
happyReduction_59 happy_x_3
happyReduce_53 = happySpecReduce_3 21# happyReduction_53
happyReduction_53 happy_x_3
happy_x_2
happy_x_1
= case happyOut8 happy_x_1 of { happy_var_1 ->
case happyOut19 happy_x_3 of { happy_var_3 ->
happyIn29
happyIn26
(FieldType happy_var_1 happy_var_3
)}}
happyReduce_60 = happySpecReduce_1 25# happyReduction_60
happyReduction_60 happy_x_1
= case happyOut29 happy_x_1 of { happy_var_1 ->
happyIn30
happyReduce_54 = happySpecReduce_0 22# happyReduction_54
happyReduction_54 = happyIn27
([]
)
happyReduce_55 = happySpecReduce_1 22# happyReduction_55
happyReduction_55 happy_x_1
= case happyOut26 happy_x_1 of { happy_var_1 ->
happyIn27
((:[]) happy_var_1
)}
happyReduce_61 = happySpecReduce_3 25# happyReduction_61
happyReduction_61 happy_x_3
happyReduce_56 = happySpecReduce_3 22# happyReduction_56
happyReduction_56 happy_x_3
happy_x_2
happy_x_1
= case happyOut29 happy_x_1 of { happy_var_1 ->
case happyOut30 happy_x_3 of { happy_var_3 ->
happyIn30
= case happyOut26 happy_x_1 of { happy_var_1 ->
case happyOut27 happy_x_3 of { happy_var_3 ->
happyIn27
((:) happy_var_1 happy_var_3
)}}
happyReduce_57 = happySpecReduce_3 23# happyReduction_57
happyReduction_57 happy_x_3
happy_x_2
happy_x_1
= case happyOut8 happy_x_1 of { happy_var_1 ->
case happyOut19 happy_x_3 of { happy_var_3 ->
happyIn28
(FieldValue happy_var_1 happy_var_3
)}}
happyReduce_58 = happySpecReduce_0 24# happyReduction_58
happyReduction_58 = happyIn29
([]
)
happyReduce_59 = happySpecReduce_1 24# happyReduction_59
happyReduction_59 happy_x_1
= case happyOut28 happy_x_1 of { happy_var_1 ->
happyIn29
((:[]) happy_var_1
)}
happyReduce_60 = happySpecReduce_3 24# happyReduction_60
happyReduction_60 happy_x_3
happy_x_2
happy_x_1
= case happyOut28 happy_x_1 of { happy_var_1 ->
case happyOut29 happy_x_3 of { happy_var_3 ->
happyIn29
((:) happy_var_1 happy_var_3
)}}
happyReduce_61 = happySpecReduce_1 25# happyReduction_61
happyReduction_61 happy_x_1
= case happyOut22 happy_x_1 of { happy_var_1 ->
happyIn30
(happy_var_1
)}
happyReduce_62 = happySpecReduce_3 26# happyReduction_62
happyReduction_62 happy_x_3
happy_x_2
happy_x_1
= case happyOut8 happy_x_1 of { happy_var_1 ->
= case happyOut15 happy_x_1 of { happy_var_1 ->
case happyOut19 happy_x_3 of { happy_var_3 ->
happyIn31
(FieldValue happy_var_1 happy_var_3
(Case happy_var_1 happy_var_3
)}}
happyReduce_63 = happySpecReduce_1 27# happyReduction_63
happyReduction_63 happy_x_1
happyReduce_63 = happySpecReduce_0 27# happyReduction_63
happyReduction_63 = happyIn32
([]
)
happyReduce_64 = happySpecReduce_1 27# happyReduction_64
happyReduction_64 happy_x_1
= case happyOut31 happy_x_1 of { happy_var_1 ->
happyIn32
((:[]) happy_var_1
)}
happyReduce_64 = happySpecReduce_3 27# happyReduction_64
happyReduction_64 happy_x_3
happyReduce_65 = happySpecReduce_3 27# happyReduction_65
happyReduction_65 happy_x_3
happy_x_2
happy_x_1
= case happyOut31 happy_x_1 of { happy_var_1 ->
@@ -806,7 +816,7 @@ happyReduction_64 happy_x_3
)}}
happyNewToken action sts stk [] =
happyDoAction 24# (error "reading EOF!") action sts stk []
happyDoAction 26# (error "reading EOF!") action sts stk []
happyNewToken action sts stk (tk:tks) =
let cont i = happyDoAction i tk action sts stk tks in
@@ -828,12 +838,14 @@ happyNewToken action sts stk (tk:tks) =
PT _ (TS "in") -> cont 15#;
PT _ (TS "let") -> cont 16#;
PT _ (TS "of") -> cont 17#;
PT _ (TS "where") -> cont 18#;
PT _ (TL happy_dollar_dollar) -> cont 19#;
PT _ (TI happy_dollar_dollar) -> cont 20#;
PT _ (T_TMeta happy_dollar_dollar) -> cont 21#;
PT _ (T_CIdent happy_dollar_dollar) -> cont 22#;
_ -> cont 23#;
PT _ (TS "rec") -> cont 18#;
PT _ (TS "sig") -> cont 19#;
PT _ (TS "where") -> cont 20#;
PT _ (TL happy_dollar_dollar) -> cont 21#;
PT _ (TI happy_dollar_dollar) -> cont 22#;
PT _ (T_TMeta happy_dollar_dollar) -> cont 23#;
PT _ (T_CIdent happy_dollar_dollar) -> cont 24#;
_ -> cont 25#;
_ -> happyError' (tk:tks)
}

View File

@@ -31,6 +31,8 @@ import Transfer.ErrM
'in' { PT _ (TS "in") }
'let' { PT _ (TS "let") }
'of' { PT _ (TS "of") }
'rec' { PT _ (TS "rec") }
'sig' { PT _ (TS "sig") }
'where' { PT _ (TS "where") }
L_quoted { PT _ (TL $$) }
@@ -81,7 +83,7 @@ ListPattern : {- empty -} { [] }
Pattern :: { Pattern }
Pattern : '(' CIdent ListPattern ')' { PCons $2 (reverse $3) }
| PatternVariable { PVar $1 }
| '{' ListFieldPattern '}' { PRec $2 }
| 'rec' '{' ListFieldPattern '}' { PRec $3 }
| 'Type' { PType }
| String { PStr $1 }
| Integer { PInt $1 }
@@ -135,9 +137,8 @@ Exp4 : Exp4 '.' CIdent { EProj $1 $3 }
Exp5 :: { Exp }
Exp5 : '{' '}' { EEmptyRec }
| '{' ListFieldType '}' { ERecType $2 }
| '{' ListFieldValue '}' { ERec $2 }
Exp5 : 'sig' '{' ListFieldType '}' { ERecType $3 }
| 'rec' '{' ListFieldValue '}' { ERec $3 }
| CIdent { EVar $1 }
| 'Type' { EType }
| String { EStr $1 }
@@ -146,6 +147,26 @@ Exp5 : '{' '}' { EEmptyRec }
| '(' Exp ')' { $2 }
FieldType :: { FieldType }
FieldType : CIdent ':' Exp { FieldType $1 $3 }
ListFieldType :: { [FieldType] }
ListFieldType : {- empty -} { [] }
| FieldType { (:[]) $1 }
| FieldType ';' ListFieldType { (:) $1 $3 }
FieldValue :: { FieldValue }
FieldValue : CIdent '=' Exp { FieldValue $1 $3 }
ListFieldValue :: { [FieldValue] }
ListFieldValue : {- empty -} { [] }
| FieldValue { (:[]) $1 }
| FieldValue ';' ListFieldValue { (:) $1 $3 }
Exp1 :: { Exp }
Exp1 : Exp2 { $1 }
@@ -160,24 +181,6 @@ ListCase : {- empty -} { [] }
| Case ';' ListCase { (:) $1 $3 }
FieldType :: { FieldType }
FieldType : CIdent ':' Exp { FieldType $1 $3 }
ListFieldType :: { [FieldType] }
ListFieldType : FieldType { (:[]) $1 }
| FieldType ';' ListFieldType { (:) $1 $3 }
FieldValue :: { FieldValue }
FieldValue : CIdent '=' Exp { FieldValue $1 $3 }
ListFieldValue :: { [FieldValue] }
ListFieldValue : FieldValue { (:[]) $1 }
| FieldValue ';' ListFieldValue { (:) $1 $3 }
{

View File

@@ -87,7 +87,7 @@ instance Print (Tree c) where
ConsDecl cident exp -> prPrec _i 0 (concatD [prt 0 cident , doc (showString ":") , prt 0 exp])
PCons cident patterns -> prPrec _i 0 (concatD [doc (showString "(") , prt 0 cident , prt 0 patterns , doc (showString ")")])
PVar patternvariable -> prPrec _i 0 (concatD [prt 0 patternvariable])
PRec fieldpatterns -> prPrec _i 0 (concatD [doc (showString "{") , prt 0 fieldpatterns , doc (showString "}")])
PRec fieldpatterns -> prPrec _i 0 (concatD [doc (showString "rec") , doc (showString "{") , prt 0 fieldpatterns , doc (showString "}")])
PType -> prPrec _i 0 (concatD [doc (showString "Type")])
PStr str -> prPrec _i 0 (concatD [prt 0 str])
PInt n -> prPrec _i 0 (concatD [prt 0 n])
@@ -100,18 +100,17 @@ instance Print (Tree c) where
EPi patternvariable exp0 exp1 -> prPrec _i 2 (concatD [doc (showString "(") , prt 0 patternvariable , doc (showString ":") , prt 0 exp0 , doc (showString ")") , doc (showString "->") , prt 0 exp1])
EApp exp0 exp1 -> prPrec _i 3 (concatD [prt 3 exp0 , prt 4 exp1])
EProj exp cident -> prPrec _i 4 (concatD [prt 4 exp , doc (showString ".") , prt 0 cident])
EEmptyRec -> prPrec _i 5 (concatD [doc (showString "{") , doc (showString "}")])
ERecType fieldtypes -> prPrec _i 5 (concatD [doc (showString "{") , prt 0 fieldtypes , doc (showString "}")])
ERec fieldvalues -> prPrec _i 5 (concatD [doc (showString "{") , prt 0 fieldvalues , doc (showString "}")])
ERecType fieldtypes -> prPrec _i 5 (concatD [doc (showString "sig") , doc (showString "{") , prt 0 fieldtypes , doc (showString "}")])
ERec fieldvalues -> prPrec _i 5 (concatD [doc (showString "rec") , doc (showString "{") , prt 0 fieldvalues , doc (showString "}")])
EVar cident -> prPrec _i 5 (concatD [prt 0 cident])
EType -> prPrec _i 5 (concatD [doc (showString "Type")])
EStr str -> prPrec _i 5 (concatD [prt 0 str])
EInt n -> prPrec _i 5 (concatD [prt 0 n])
EMeta tmeta -> prPrec _i 5 (concatD [prt 0 tmeta])
LetDef cident exp0 exp1 -> prPrec _i 0 (concatD [prt 0 cident , 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])
FieldType cident exp -> prPrec _i 0 (concatD [prt 0 cident , doc (showString ":") , prt 0 exp])
FieldValue cident exp -> prPrec _i 0 (concatD [prt 0 cident , doc (showString "=") , prt 0 exp])
Case pattern exp -> prPrec _i 0 (concatD [prt 0 pattern , doc (showString "->") , prt 0 exp])
TMeta str -> prPrec _i 0 (doc (showString str))
CIdent str -> prPrec _i 0 (doc (showString str))
@@ -139,16 +138,18 @@ instance Print [LetDef] where
[] -> (concatD [])
[x] -> (concatD [prt 0 x])
x:xs -> (concatD [prt 0 x , doc (showString ";") , prt 0 xs])
instance Print [FieldType] where
prt _ es = case es of
[] -> (concatD [])
[x] -> (concatD [prt 0 x])
x:xs -> (concatD [prt 0 x , doc (showString ";") , prt 0 xs])
instance Print [FieldValue] where
prt _ es = case es of
[] -> (concatD [])
[x] -> (concatD [prt 0 x])
x:xs -> (concatD [prt 0 x , doc (showString ";") , prt 0 xs])
instance Print [Case] where
prt _ es = case es of
[] -> (concatD [])
[x] -> (concatD [prt 0 x])
x:xs -> (concatD [prt 0 x , doc (showString ";") , prt 0 xs])
instance Print [FieldType] where
prt _ es = case es of
[x] -> (concatD [prt 0 x])
x:xs -> (concatD [prt 0 x , doc (showString ";") , prt 0 xs])
instance Print [FieldValue] where
prt _ es = case es of
[x] -> (concatD [prt 0 x])
x:xs -> (concatD [prt 0 x , doc (showString ";") , prt 0 xs])

View File

@@ -31,7 +31,6 @@ transTree t = case t of
EPi patternvariable exp0 exp1 -> failure t
EApp exp0 exp1 -> failure t
EProj exp cident -> failure t
EEmptyRec -> failure t
ERecType fieldtypes -> failure t
ERec fieldvalues -> failure t
EVar cident -> failure t
@@ -40,9 +39,9 @@ transTree t = case t of
EInt n -> failure t
EMeta tmeta -> failure t
LetDef cident exp0 exp1 -> failure t
Case pattern exp -> failure t
FieldType cident exp -> failure t
FieldValue cident exp -> failure t
Case pattern exp -> failure t
TMeta str -> failure t
CIdent str -> failure t
@@ -86,7 +85,6 @@ transExp t = case t of
EPi patternvariable exp0 exp1 -> failure t
EApp exp0 exp1 -> failure t
EProj exp cident -> failure t
EEmptyRec -> failure t
ERecType fieldtypes -> failure t
ERec fieldvalues -> failure t
EVar cident -> failure t
@@ -99,10 +97,6 @@ transLetDef :: LetDef -> Result
transLetDef t = case t of
LetDef cident exp0 exp1 -> failure t
transCase :: Case -> Result
transCase t = case t of
Case pattern exp -> failure t
transFieldType :: FieldType -> Result
transFieldType t = case t of
FieldType cident exp -> failure t
@@ -111,6 +105,10 @@ transFieldValue :: FieldValue -> Result
transFieldValue t = case t of
FieldValue cident exp -> failure t
transCase :: Case -> Result
transCase t = case t of
Case pattern exp -> failure t
transTMeta :: TMeta -> Result
transTMeta t = case t of
TMeta str -> failure t

View File

@@ -123,7 +123,6 @@ eval env x = case x of
_ -> error $ printValue v ++ " is not a record, "
++ "cannot get field " ++ printTree id
EEmptyRec -> VRec []
ERecType fts -> VRec $! deepSeqList $! [v `seq` (f,v) | FieldType f e <- fts,
let v = eval env e]
ERec fvs -> VRec $! deepSeqList $! [v `seq` (f,v) | FieldValue f e <- fvs,

View File

@@ -72,7 +72,6 @@ data Tree :: * -> * where
ENeg :: Exp -> Tree Exp_
EApp :: Exp -> Exp -> Tree Exp_
EProj :: Exp -> Ident -> Tree Exp_
EEmptyRec :: Tree Exp_
ERecType :: [FieldType] -> Tree Exp_
ERec :: [FieldValue] -> Tree Exp_
EVar :: Ident -> Tree Exp_
@@ -232,7 +231,6 @@ instance Show (Tree c) where
ENeg exp -> opar n . showString "ENeg" . showChar ' ' . showsPrec 1 exp . cpar n
EApp exp0 exp1 -> opar n . showString "EApp" . showChar ' ' . showsPrec 1 exp0 . showChar ' ' . showsPrec 1 exp1 . cpar n
EProj exp i -> opar n . showString "EProj" . showChar ' ' . showsPrec 1 exp . showChar ' ' . showsPrec 1 i . cpar n
EEmptyRec -> showString "EEmptyRec"
ERecType fieldtypes -> opar n . showString "ERecType" . showChar ' ' . showsPrec 1 fieldtypes . cpar n
ERec fieldvalues -> opar n . showString "ERec" . showChar ' ' . showsPrec 1 fieldvalues . cpar n
EVar i -> opar n . showString "EVar" . showChar ' ' . showsPrec 1 i . cpar n
@@ -291,7 +289,6 @@ johnMajorEq (EMod exp0 exp1) (EMod exp0_ exp1_) = exp0 == exp0_ && exp1 == exp1_
johnMajorEq (ENeg exp) (ENeg exp_) = exp == exp_
johnMajorEq (EApp exp0 exp1) (EApp exp0_ exp1_) = exp0 == exp0_ && exp1 == exp1_
johnMajorEq (EProj exp i) (EProj exp_ i_) = exp == exp_ && i == i_
johnMajorEq EEmptyRec EEmptyRec = True
johnMajorEq (ERecType fieldtypes) (ERecType fieldtypes_) = fieldtypes == fieldtypes_
johnMajorEq (ERec fieldvalues) (ERec fieldvalues_) = fieldvalues == fieldvalues_
johnMajorEq (EVar i) (EVar i_) = i == i_
@@ -349,21 +346,20 @@ instance Ord (Tree c) where
index (ENeg _) = 35
index (EApp _ _) = 36
index (EProj _ _) = 37
index (EEmptyRec ) = 38
index (ERecType _) = 39
index (ERec _) = 40
index (EVar _) = 41
index (EType ) = 42
index (EStr _) = 43
index (EInt _) = 44
index (EMeta ) = 45
index (LetDef _ _ _) = 46
index (Case _ _) = 47
index (VVar _) = 48
index (VWild ) = 49
index (FieldType _ _) = 50
index (FieldValue _ _) = 51
index (Ident _) = 52
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
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_))
@@ -402,7 +398,6 @@ instance Ord (Tree c) where
compareSame (ENeg exp) (ENeg exp_) = compare exp exp_
compareSame (EApp exp0 exp1) (EApp exp0_ exp1_) = mappend (compare exp0 exp0_) (compare exp1 exp1_)
compareSame (EProj exp i) (EProj exp_ i_) = mappend (compare exp exp_) (compare i i_)
compareSame EEmptyRec EEmptyRec = EQ
compareSame (ERecType fieldtypes) (ERecType fieldtypes_) = compare fieldtypes fieldtypes_
compareSame (ERec fieldvalues) (ERec fieldvalues_) = compare fieldvalues fieldvalues_
compareSame (EVar i) (EVar i_) = compare i i_

View File

@@ -48,7 +48,8 @@ The reserved words used in Syntax are the following: \\
{\reserved{Type}} &{\reserved{case}} &{\reserved{data}} \\
{\reserved{derive}} &{\reserved{else}} &{\reserved{if}} \\
{\reserved{import}} &{\reserved{in}} &{\reserved{let}} \\
{\reserved{of}} &{\reserved{then}} &{\reserved{where}} \\
{\reserved{of}} &{\reserved{rec}} &{\reserved{sig}} \\
{\reserved{then}} &{\reserved{where}} & \\
\end{tabular}\\
The symbols used in Syntax are the following: \\
@@ -118,7 +119,7 @@ All other symbols are terminals.\\
\begin{tabular}{lll}
{\nonterminal{Pattern1}} & {\arrow} &{\terminal{(}} {\nonterminal{Ident}} {\nonterminal{ListPattern}} {\terminal{)}} \\
& {\delimit} &{\terminal{\{}} {\nonterminal{ListFieldPattern}} {\terminal{\}}} \\
& {\delimit} &{\terminal{rec}} {\terminal{\{}} {\nonterminal{ListFieldPattern}} {\terminal{\}}} \\
& {\delimit} &{\terminal{Type}} \\
& {\delimit} &{\nonterminal{String}} \\
& {\delimit} &{\nonterminal{Integer}} \\
@@ -229,9 +230,8 @@ All other symbols are terminals.\\
\end{tabular}\\
\begin{tabular}{lll}
{\nonterminal{Exp11}} & {\arrow} &{\terminal{\{}} {\terminal{\}}} \\
& {\delimit} &{\terminal{\{}} {\nonterminal{ListFieldType}} {\terminal{\}}} \\
& {\delimit} &{\terminal{\{}} {\nonterminal{ListFieldValue}} {\terminal{\}}} \\
{\nonterminal{Exp11}} & {\arrow} &{\terminal{sig}} {\terminal{\{}} {\nonterminal{ListFieldType}} {\terminal{\}}} \\
& {\delimit} &{\terminal{rec}} {\terminal{\{}} {\nonterminal{ListFieldValue}} {\terminal{\}}} \\
& {\delimit} &{\nonterminal{Ident}} \\
& {\delimit} &{\terminal{Type}} \\
& {\delimit} &{\nonterminal{String}} \\
@@ -245,7 +245,8 @@ All other symbols are terminals.\\
\end{tabular}\\
\begin{tabular}{lll}
{\nonterminal{ListFieldType}} & {\arrow} &{\nonterminal{FieldType}} \\
{\nonterminal{ListFieldType}} & {\arrow} &{\emptyP} \\
& {\delimit} &{\nonterminal{FieldType}} \\
& {\delimit} &{\nonterminal{FieldType}} {\terminal{;}} {\nonterminal{ListFieldType}} \\
\end{tabular}\\
@@ -254,7 +255,8 @@ All other symbols are terminals.\\
\end{tabular}\\
\begin{tabular}{lll}
{\nonterminal{ListFieldValue}} & {\arrow} &{\nonterminal{FieldValue}} \\
{\nonterminal{ListFieldValue}} & {\arrow} &{\emptyP} \\
& {\delimit} &{\nonterminal{FieldValue}} \\
& {\delimit} &{\nonterminal{FieldValue}} {\terminal{;}} {\nonterminal{ListFieldValue}} \\
\end{tabular}\\

View File

@@ -10,7 +10,7 @@ import Data.Maybe (isNothing, fromJust)
-- local parameters
topLayout = True
layoutWords = ["let","where","of"]
layoutWords = ["let","where","of","rec","sig"]
layoutStopWords = ["in"]
-- layout separators

View File

@@ -84,7 +84,7 @@ eitherResIdent tv s = treeFind resWords
| s > a = treeFind right
| s == a = t
resWords = b "import" (b "derive" (b "case" (b "Type" N N) (b "data" N N)) (b "if" (b "else" N N) N)) (b "of" (b "let" (b "in" N N) N) (b "where" (b "then" N N) N))
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))
where b s = B s (TS s)
unescapeInitTail :: String -> String

View File

@@ -79,7 +79,7 @@ eitherResIdent tv s = treeFind resWords
| s > a = treeFind right
| s == a = t
resWords = b "import" (b "derive" (b "case" (b "Type" N N) (b "data" N N)) (b "if" (b "else" N N) N)) (b "of" (b "let" (b "in" N N) N) (b "where" (b "then" N N) N))
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))
where b s = B s (TS s)
unescapeInitTail :: String -> String

File diff suppressed because one or more lines are too long

View File

@@ -49,6 +49,8 @@ import Transfer.ErrM
'in' { PT _ (TS "in") }
'let' { PT _ (TS "let") }
'of' { PT _ (TS "of") }
'rec' { PT _ (TS "rec") }
'sig' { PT _ (TS "sig") }
'then' { PT _ (TS "then") }
'where' { PT _ (TS "where") }
@@ -108,7 +110,7 @@ Pattern : Ident Pattern1 ListPattern { PConsTop $1 $2 (reverse $3) }
Pattern1 :: { Pattern }
Pattern1 : '(' Ident ListPattern ')' { PCons $2 (reverse $3) }
| '{' ListFieldPattern '}' { PRec $2 }
| 'rec' '{' ListFieldPattern '}' { PRec $3 }
| 'Type' { PType }
| String { PStr $1 }
| Integer { PInt $1 }
@@ -219,9 +221,8 @@ Exp10 : Exp10 '.' Ident { EProj $1 $3 }
Exp11 :: { Exp }
Exp11 : '{' '}' { EEmptyRec }
| '{' ListFieldType '}' { ERecType $2 }
| '{' ListFieldValue '}' { ERec $2 }
Exp11 : 'sig' '{' ListFieldType '}' { ERecType $3 }
| 'rec' '{' ListFieldValue '}' { ERec $3 }
| Ident { EVar $1 }
| 'Type' { EType }
| String { EStr $1 }
@@ -235,7 +236,8 @@ FieldType : Ident ':' Exp { FieldType $1 $3 }
ListFieldType :: { [FieldType] }
ListFieldType : FieldType { (:[]) $1 }
ListFieldType : {- empty -} { [] }
| FieldType { (:[]) $1 }
| FieldType ';' ListFieldType { (:) $1 $3 }
@@ -244,7 +246,8 @@ FieldValue : Ident '=' Exp { FieldValue $1 $3 }
ListFieldValue :: { [FieldValue] }
ListFieldValue : FieldValue { (:[]) $1 }
ListFieldValue : {- empty -} { [] }
| FieldValue { (:[]) $1 }
| FieldValue ';' ListFieldValue { (:) $1 $3 }

View File

@@ -89,7 +89,7 @@ instance Print (Tree c) where
ConsDecl i exp -> prPrec _i 0 (concatD [prt 0 i , doc (showString ":") , prt 0 exp])
PConsTop i pattern patterns -> prPrec _i 0 (concatD [prt 0 i , prt 1 pattern , prt 0 patterns])
PCons i patterns -> prPrec _i 1 (concatD [doc (showString "(") , prt 0 i , prt 0 patterns , doc (showString ")")])
PRec fieldpatterns -> prPrec _i 1 (concatD [doc (showString "{") , prt 0 fieldpatterns , doc (showString "}")])
PRec fieldpatterns -> prPrec _i 1 (concatD [doc (showString "rec") , doc (showString "{") , prt 0 fieldpatterns , doc (showString "}")])
PType -> prPrec _i 1 (concatD [doc (showString "Type")])
PStr str -> prPrec _i 1 (concatD [prt 0 str])
PInt n -> prPrec _i 1 (concatD [prt 0 n])
@@ -118,9 +118,8 @@ instance Print (Tree c) where
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])
EEmptyRec -> prPrec _i 11 (concatD [doc (showString "{") , doc (showString "}")])
ERecType fieldtypes -> prPrec _i 11 (concatD [doc (showString "{") , prt 0 fieldtypes , doc (showString "}")])
ERec fieldvalues -> prPrec _i 11 (concatD [doc (showString "{") , prt 0 fieldvalues , doc (showString "}")])
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])
@@ -170,9 +169,11 @@ instance Print [Case] where
x:xs -> (concatD [prt 0 x , doc (showString ";") , prt 0 xs])
instance Print [FieldType] where
prt _ es = case es of
[] -> (concatD [])
[x] -> (concatD [prt 0 x])
x:xs -> (concatD [prt 0 x , doc (showString ";") , prt 0 xs])
instance Print [FieldValue] where
prt _ es = case es of
[] -> (concatD [])
[x] -> (concatD [prt 0 x])
x:xs -> (concatD [prt 0 x , doc (showString ";") , prt 0 xs])

View File

@@ -49,7 +49,6 @@ transTree t = case t of
ENeg exp -> failure t
EApp exp0 exp1 -> failure t
EProj exp i -> failure t
EEmptyRec -> failure t
ERecType fieldtypes -> failure t
ERec fieldvalues -> failure t
EVar i -> failure t
@@ -123,7 +122,6 @@ transExp t = case t of
ENeg exp -> failure t
EApp exp0 exp1 -> failure t
EProj exp i -> failure t
EEmptyRec -> failure t
ERecType fieldtypes -> failure t
ERec fieldvalues -> failure t
EVar i -> failure t

View File

@@ -1,6 +1,6 @@
entrypoints Module, Exp ;
layout "let", "where", "of" ;
layout "let", "where", "of","rec", "sig" ;
layout stop "in" ;
layout toplevel ;
@@ -28,7 +28,7 @@ _. Pattern ::= Pattern1 ;
-- Constructor pattern with parantheses
PCons. Pattern1 ::= "(" Ident [Pattern] ")" ;
-- Record patterns
PRec. Pattern1 ::= "{" [FieldPattern] "}";
PRec. Pattern1 ::= "rec" "{" [FieldPattern] "}";
-- The pattern matching the Type constant
PType. Pattern1 ::= "Type" ;
-- String literal patterns
@@ -85,15 +85,13 @@ EApp. Exp9 ::= Exp9 Exp10 ;
EProj. Exp10 ::= Exp10 "." Ident ;
EEmptyRec. Exp11 ::= "{" "}" ;
ERecType. Exp11 ::= "{" [FieldType] "}" ;
ERecType. Exp11 ::= "sig" "{" [FieldType] "}" ;
FieldType. FieldType ::= Ident ":" Exp ;
separator nonempty FieldType ";" ;
separator FieldType ";" ;
ERec. Exp11 ::= "{" [FieldValue] "}" ;
ERec. Exp11 ::= "rec" "{" [FieldValue] "}" ;
FieldValue.FieldValue ::= Ident "=" Exp ;
separator nonempty FieldValue ";" ;
separator FieldValue ";" ;
EVar. Exp11 ::= Ident ;
EType. Exp11 ::= "Type" ;

View File

@@ -91,8 +91,7 @@ mergeDecls ds@(ValueDecl x p _:_)
return $ ValueDecl x [] f
where mkRec r f = r . zipWith (\i e -> f (Ident ("p"++show i)) e) [0..]
mkPRec = mkRec PRec FieldPattern
mkERec xs | null xs = EEmptyRec
| otherwise = mkRec ERec FieldValue xs
mkERec = mkRec ERec FieldValue
--
-- * Derived function definitions
@@ -284,7 +283,7 @@ removeUselessMatch = return . map f
e -> EAbs (VVar x) e
-- for value declarations without patterns, compilePattDecls
-- generates pattern matching on the empty record, remove these
ECase EEmptyRec [Case (PRec []) e] -> f e
ECase (ERec []) [Case (PRec []) e] -> f e
-- if the pattern matching is on a single field of a record expression
-- with only one field, there is no need to wrap it in a record
ECase (ERec [FieldValue x e]) cs | all (isSingleFieldPattern x) [ p | Case p _ <- cs]

View File

@@ -1,9 +1,5 @@
* Improve front-end language
- Layout syntax, this program is not handled correctly:
f = \x -> case x of
{ r = _ } -> 0
- Tuple syntax in expressions, types and patterns. Implemented with records.
- List syntax in expressions, types and patterns. Implemented with List.