diff options
| author | aarne <unknown> | 2004-12-20 07:57:05 +0000 |
|---|---|---|
| committer | aarne <unknown> | 2004-12-20 07:57:05 +0000 |
| commit | 6e1f41b26af8154033fda32c573aba56d7cb89fb (patch) | |
| tree | cdfd17dd3a1444f3a921cadc6d0a141178767819 /examples/gfcc/compiler | |
| parent | 8caa3ed737900c0fc004b24720f909244d17dd59 (diff) | |
gfcc in Types
Diffstat (limited to 'examples/gfcc/compiler')
| -rw-r--r-- | examples/gfcc/compiler/CleanJVM.hs | 22 | ||||
| -rw-r--r-- | examples/gfcc/compiler/LexImperC.hs | 24 | ||||
| -rw-r--r-- | examples/gfcc/compiler/ParImperC.hs | 164 |
3 files changed, 88 insertions, 122 deletions
diff --git a/examples/gfcc/compiler/CleanJVM.hs b/examples/gfcc/compiler/CleanJVM.hs index 7dafa0083..ab879ff0e 100644 --- a/examples/gfcc/compiler/CleanJVM.hs +++ b/examples/gfcc/compiler/CleanJVM.hs @@ -24,27 +24,23 @@ mkJVM cls = unlines . reverse . fst . foldl trans ([],([],0)) . lines where | f == "main" -> (".method public static main([Ljava/lang/String;)V":code,([],1)) | otherwise -> - (unwords [".method",p,s, f ++ typesig ns] : code,([],0)) + (unwords [".method",p,s, f ++ glue ns] : code,([],0)) "alloc":t:x:_ -> (("; " ++ s):code, ((x,v):env, v + size t)) ".limit":"locals":ns -> chCode (".limit locals " ++ show (length ns)) - "invokestatic":t:f:ns - | take 8 f == "runtime/" -> - chCode $ "invokestatic " ++ "runtime/" ++ t ++ drop 8 f ++ typesig ns - "invokestatic":f:ns -> - chCode $ "invokestatic " ++ cls ++ "/" ++ f ++ typesig ns + "runtime":f:ns -> chCode $ "invokestatic " ++ "runtime/" ++ f ++ glue ns + "static":f:ns -> chCode $ "invokestatic " ++ cls ++ "/" ++ f ++ glue ns "alloc":ns -> chCode $ "; " ++ s - t:('_':instr):[";"] -> chCode $ t ++ instr - t:('_':instr):x:_ -> chCode $ t ++ instr ++ " " ++ look x - "goto":ns -> chCode $ "goto " ++ label ns - "ifeq":ns -> chCode $ "ifeq " ++ label ns - "label":ns -> chCode $ label ns ++ ":" + ins:x:_ | symb ins -> chCode $ ins ++ " " ++ look x + "goto":ns -> chCode $ "goto " ++ glue ns + "ifeq":ns -> chCode $ "ifeq " ++ glue ns + "label":ns -> chCode $ glue ns ++ ":" ";":[] -> chCode "" _ -> chCode s where chCode c = (c:code,(env,v)) look x = maybe (error $ x ++ show env) show $ lookup x env - typesig = init . map toUpper . concat - label = init . concat + glue = init . concat + symb = flip elem ["load","store"] . tail size t = case t of "d" -> 2 _ -> 1 diff --git a/examples/gfcc/compiler/LexImperC.hs b/examples/gfcc/compiler/LexImperC.hs index d030a8cd5..ceec89d25 100644 --- a/examples/gfcc/compiler/LexImperC.hs +++ b/examples/gfcc/compiler/LexImperC.hs @@ -60,20 +60,18 @@ prToken t = case t of _ -> show t +data BTree = N | B String Tok BTree BTree deriving (Show) + eitherResIdent :: (String -> Tok) -> String -> Tok -eitherResIdent tv s = if isResWord s then (TS s) else (tv s) where - isResWord s = isInTree s $ - B "int" (B "float" (B "else" N N) (B "if" N N)) (B "return" (B "printf" N N) (B "while" N N)) - -data BTree = N | B String BTree BTree deriving (Show) - -isInTree :: String -> BTree -> Bool -isInTree x tree = case tree of - N -> False - B a left right - | x < a -> isInTree x left - | x > a -> isInTree x right - | x == a -> True +eitherResIdent tv s = treeFind resWords + where + treeFind N = tv s + treeFind (B a t left right) | s < a = treeFind left + | s > a = treeFind right + | s == a = t + +resWords = b "int" (b "float" (b "else" N N) (b "if" N N)) (b "return" (b "printf" N N) (b "while" N N)) + where b s = B s (TS s) unescapeInitTail :: String -> String unescapeInitTail = unesc . tail where diff --git a/examples/gfcc/compiler/ParImperC.hs b/examples/gfcc/compiler/ParImperC.hs index c37222bd1..afa46955c 100644 --- a/examples/gfcc/compiler/ParImperC.hs +++ b/examples/gfcc/compiler/ParImperC.hs @@ -109,18 +109,6 @@ happyIn21 x = unsafeCoerce# x happyOut21 :: (HappyAbsSyn t6 t7) -> (CFTree) happyOut21 x = unsafeCoerce# x {-# INLINE happyOut21 #-} -happyIn22 :: (CFTree) -> (HappyAbsSyn t6 t7) -happyIn22 x = unsafeCoerce# x -{-# INLINE happyIn22 #-} -happyOut22 :: (HappyAbsSyn t6 t7) -> (CFTree) -happyOut22 x = unsafeCoerce# x -{-# INLINE happyOut22 #-} -happyIn23 :: (CFTree) -> (HappyAbsSyn t6 t7) -happyIn23 x = unsafeCoerce# x -{-# INLINE happyIn23 #-} -happyOut23 :: (HappyAbsSyn t6 t7) -> (CFTree) -happyOut23 x = unsafeCoerce# x -{-# INLINE happyOut23 #-} happyInTok :: Token -> (HappyAbsSyn t6 t7) happyInTok x = unsafeCoerce# x {-# INLINE happyInTok #-} @@ -129,21 +117,21 @@ happyOutTok x = unsafeCoerce# x {-# INLINE happyOutTok #-} happyActOffsets :: HappyAddr -happyActOffsets = HappyA# "\xf8\xff\xfc\xff\x05\x00\xcc\x00\x00\x00\xde\x00\xd5\x00\xc8\x00\x00\x00\xc4\x00\xd1\x00\x00\x00\x05\x00\x00\x00\xda\x00\xc2\x00\xc6\x00\x00\x00\xfc\xff\x00\x00\xd9\x00\x00\x00\xd8\x00\x03\x00\xd7\x00\xc1\x00\xbd\x00\xd4\x00\x05\x00\xd0\x00\x00\x00\x2c\x00\x05\x00\xcb\x00\xcf\x00\x05\x00\xcd\x00\x05\x00\x05\x00\x05\x00\x05\x00\xb4\x00\x01\x00\xc3\x00\x89\x00\x00\x00\x00\x00\x7d\x00\xfb\xff\x7d\x00\x00\x00\x00\x00\xc5\x00\xfc\xff\xfc\xff\x87\x00\x6f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x86\x00\x11\x00\x6c\x00\x76\x00\x6b\x00\xfc\xff\x05\x00\xfc\xff\x00\x00\x00\x00\xfc\xff\x00\x00\x05\x00\x00\x00\x00\x00\x63\x00\x6a\x00\xfc\xff\xfc\xff\x61\x00\x59\x00\xf8\xff\xfc\xff\x64\x00\x00\x00\x60\x00\xfc\xff\xfc\xff\xfc\xff\x5a\x00\x00\x00\x52\x00\x00\x00\x48\x00\xf8\xff\x00\x00\x00\x00\x00\x00\xf8\xff\x00\x00\x29\x00\x00\x00"# +happyActOffsets = HappyA# "\x1c\x00\xfc\xff\x05\x00\xc0\x00\x00\x00\xcb\x00\xc2\x00\xbf\x00\x00\x00\x21\x00\xbe\x00\x00\x00\x05\x00\x00\x00\xc7\x00\xba\x00\xb3\x00\xfc\xff\x00\x00\xc5\x00\x00\x00\xc4\x00\x03\x00\xc3\x00\xb1\x00\xaa\x00\xc1\x00\x05\x00\xbd\x00\x00\x00\x0c\x00\x05\x00\xb9\x00\xbc\x00\x05\x00\xbb\x00\x05\x00\x05\x00\x05\x00\x05\x00\xa4\x00\x01\x00\xb7\x00\xb8\x00\x00\x00\x00\x00\xaf\x00\xfb\xff\xaf\x00\x00\x00\x00\x00\xb5\x00\xfc\xff\xfc\xff\xb6\x00\xb0\x00\x00\x00\x00\x00\x00\x00\xb4\x00\x11\x00\x9f\x00\xb2\x00\xae\x00\xfc\xff\x05\x00\xfc\xff\x00\x00\x00\x00\xfc\xff\x00\x00\x05\x00\x00\x00\x00\x00\xa3\x00\xad\x00\xfc\xff\xfc\xff\xa9\x00\xa5\x00\x1c\x00\xfc\xff\x9c\x00\x00\x00\x59\x00\xfc\xff\xfc\xff\xfc\xff\x56\x00\x00\x00\x53\x00\x00\x00\x47\x00\x1c\x00\x00\x00\x00\x00\x00\x00\x1c\x00\x00\x00\x35\x00\x00\x00"# happyGotoOffsets :: HappyAddr -happyGotoOffsets = HappyA# "\x49\x00\x7a\x00\xb7\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb0\x00\x00\x00\x00\x00\x00\x00\x1f\x00\x00\x00\x74\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa9\x00\x00\x00\x1d\x00\x00\x00\x00\x00\xa2\x00\x00\x00\x00\x00\x0c\x00\x9b\x00\x00\x00\x00\x00\x94\x00\x00\x00\x36\x00\xc7\x00\xbe\x00\xc0\x00\x14\x00\x2b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6e\x00\x68\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x73\x00\x0b\x00\x00\x00\x00\x00\x62\x00\x8d\x00\x5c\x00\x00\x00\x00\x00\x56\x00\x00\x00\x24\x00\x00\x00\x00\x00\x00\x00\x00\x00\x50\x00\x4a\x00\x00\x00\x00\x00\x15\x00\x32\x00\x00\x00\x00\x00\x00\x00\x44\x00\x3e\x00\x38\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3d\x00\x00\x00\x00\x00\x00\x00\x7b\x00\x00\x00\x00\x00\x00\x00"# +happyGotoOffsets = HappyA# "\xa2\x00\x5c\x00\x90\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x89\x00\x00\x00\x00\x00\x00\x00\x4a\x00\x5b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x82\x00\x00\x00\x3c\x00\x00\x00\x00\x00\x7b\x00\x00\x00\x00\x00\x33\x00\x74\x00\x00\x00\x00\x00\x6d\x00\x00\x00\xa7\x00\xa0\x00\x97\x00\x99\x00\x2f\x00\x32\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x58\x00\x57\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15\x00\x0b\x00\x00\x00\x00\x00\x4d\x00\x66\x00\x4c\x00\x00\x00\x00\x00\x49\x00\x00\x00\x24\x00\x00\x00\x00\x00\x00\x00\x00\x00\x48\x00\x3e\x00\x00\x00\x00\x00\xff\xff\x16\x00\x00\x00\x00\x00\x00\x00\x3d\x00\x3a\x00\x39\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa1\x00\x00\x00\x00\x00\x00\x00\x9a\x00\x00\x00\x00\x00\x00\x00"# happyDefActions :: HappyAddr -happyDefActions = HappyA# "\xd4\xff\xe9\xff\x00\x00\x00\x00\xfc\xff\xed\xff\xee\xff\x00\x00\xfa\xff\xf9\xff\xf7\xff\xf4\xff\x00\x00\xfb\xff\x00\x00\x00\x00\x00\x00\xe2\xff\xe9\xff\xdf\xff\x00\x00\xde\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe5\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\xd7\xff\x00\x00\xf0\xff\xef\xff\xf5\xff\xf8\xff\xf6\xff\xf3\xff\xf2\xff\x00\x00\xe9\xff\xe9\xff\x00\x00\x00\x00\xe3\xff\xe1\xff\xe0\xff\xe6\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe9\xff\x00\x00\xe9\xff\xeb\xff\xea\xff\xe9\xff\xf1\xff\x00\x00\xd8\xff\xec\xff\x00\x00\x00\x00\xe9\xff\xe9\xff\x00\x00\xda\xff\x00\x00\xe9\xff\x00\x00\xe4\xff\x00\x00\xe9\xff\xe9\xff\xe9\xff\x00\x00\xd9\xff\x00\x00\xdb\xff\x00\x00\xd4\xff\xe7\xff\xe8\xff\xd2\xff\xd4\xff\xd3\xff\xdc\xff"# +happyDefActions = HappyA# "\xd6\xff\xe9\xff\x00\x00\x00\x00\xfc\xff\xed\xff\xee\xff\x00\x00\xfa\xff\xf9\xff\xf7\xff\xf4\xff\x00\x00\xfb\xff\x00\x00\x00\x00\x00\x00\xe9\xff\xe1\xff\x00\x00\xe0\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe5\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\xd9\xff\x00\x00\xf0\xff\xef\xff\xf5\xff\xf8\xff\xf6\xff\xf3\xff\xf2\xff\x00\x00\xe9\xff\xe9\xff\x00\x00\x00\x00\xe3\xff\xe2\xff\xe6\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe9\xff\x00\x00\xe9\xff\xeb\xff\xea\xff\xe9\xff\xf1\xff\x00\x00\xda\xff\xec\xff\x00\x00\x00\x00\xe9\xff\xe9\xff\x00\x00\xdc\xff\x00\x00\xe9\xff\x00\x00\xe4\xff\x00\x00\xe9\xff\xe9\xff\xe9\xff\x00\x00\xdb\xff\x00\x00\xdd\xff\x00\x00\xd6\xff\xe7\xff\xe8\xff\xd4\xff\xd6\xff\xd5\xff\xde\xff"# happyCheck :: HappyAddr -happyCheck = HappyA# "\xff\xff\x05\x00\x01\x00\x02\x00\x01\x00\x0a\x00\x01\x00\x04\x00\x10\x00\x0e\x00\x12\x00\x00\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x02\x00\x08\x00\x01\x00\x0a\x00\x16\x00\x17\x00\x16\x00\x17\x00\x16\x00\x17\x00\x00\x00\x09\x00\x00\x00\x0b\x00\x10\x00\x0d\x00\x12\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x00\x00\x0f\x00\x08\x00\x09\x00\x00\x00\x01\x00\x00\x00\x07\x00\x0f\x00\x09\x00\x06\x00\x0b\x00\x00\x00\x07\x00\x0e\x00\x09\x00\x19\x00\x0b\x00\x00\x00\x07\x00\x09\x00\x09\x00\x0b\x00\x0b\x00\x00\x00\x07\x00\x04\x00\x09\x00\x11\x00\x0b\x00\x00\x00\x07\x00\x09\x00\x09\x00\x0b\x00\x0b\x00\x00\x00\x07\x00\x06\x00\x09\x00\x11\x00\x0b\x00\x00\x00\x07\x00\x04\x00\x09\x00\x07\x00\x0b\x00\x00\x00\x07\x00\x04\x00\x09\x00\x05\x00\x0b\x00\x00\x00\x07\x00\x06\x00\x09\x00\x02\x00\x0b\x00\x00\x00\x07\x00\x05\x00\x09\x00\x0f\x00\x0b\x00\x00\x00\x07\x00\x07\x00\x09\x00\x02\x00\x0b\x00\x00\x00\x07\x00\x09\x00\x09\x00\x0b\x00\x0b\x00\x0d\x00\x07\x00\x16\x00\x09\x00\x09\x00\x0b\x00\x0b\x00\x0c\x00\x02\x00\x02\x00\x0d\x00\x02\x00\x11\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x00\x00\x01\x00\x00\x00\x01\x00\x04\x00\x05\x00\x06\x00\x05\x00\x06\x00\x00\x00\x01\x00\x04\x00\x07\x00\x17\x00\x05\x00\x06\x00\x0a\x00\x02\x00\x0c\x00\x06\x00\x0e\x00\x04\x00\x04\x00\x01\x00\x19\x00\x16\x00\x01\x00\x01\x00\x01\x00\x19\x00\x16\x00\x03\x00\x0d\x00\x01\x00\x0b\x00\x19\x00\x16\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"# +happyCheck = HappyA# "\xff\xff\x05\x00\x01\x00\x02\x00\x01\x00\x0a\x00\x01\x00\x04\x00\x09\x00\x0e\x00\x0b\x00\x00\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x02\x00\x08\x00\x09\x00\x00\x00\x16\x00\x17\x00\x16\x00\x17\x00\x16\x00\x17\x00\x07\x00\x09\x00\x09\x00\x0b\x00\x10\x00\x0c\x00\x12\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x0a\x00\x10\x00\x0c\x00\x12\x00\x0e\x00\x01\x00\x0d\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x0d\x00\x07\x00\x07\x00\x09\x00\x09\x00\x07\x00\x07\x00\x09\x00\x09\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x19\x00\x07\x00\x07\x00\x09\x00\x09\x00\x07\x00\x07\x00\x09\x00\x09\x00\x00\x00\x00\x00\x06\x00\x04\x00\x00\x00\x00\x00\x04\x00\x07\x00\x07\x00\x09\x00\x09\x00\x07\x00\x07\x00\x09\x00\x09\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x00\x00\x01\x00\x00\x00\x01\x00\x04\x00\x05\x00\x06\x00\x05\x00\x06\x00\x00\x00\x01\x00\x06\x00\x09\x00\x0a\x00\x05\x00\x06\x00\x00\x00\x01\x00\x0f\x00\x09\x00\x09\x00\x07\x00\x06\x00\x05\x00\x02\x00\x0f\x00\x0f\x00\x0f\x00\x05\x00\x02\x00\x16\x00\x02\x00\x07\x00\x02\x00\x04\x00\x02\x00\x17\x00\x0d\x00\x02\x00\x07\x00\x06\x00\x04\x00\x04\x00\x01\x00\x19\x00\x01\x00\x01\x00\x01\x00\x16\x00\xff\xff\x16\x00\x03\x00\x0d\x00\x01\x00\x0b\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x19\x00\xff\xff\xff\xff\x16\x00\xff\xff\x19\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"# happyTable :: HappyAddr -happyTable = HappyA# "\x00\x00\x13\x00\x0d\x00\x2e\x00\x0d\x00\x27\x00\x0d\x00\x1f\x00\x14\x00\x29\x00\x16\x00\x51\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x05\x00\x42\x00\x38\x00\x2e\x00\x39\x00\x05\x00\x0e\x00\x05\x00\x0e\x00\x05\x00\x0e\x00\x1b\x00\x3f\x00\x22\x00\x11\x00\x14\x00\x5d\x00\x16\x00\x05\x00\x06\x00\x2b\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x05\x00\x06\x00\x2b\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x0e\x00\x4a\x00\x3b\x00\x3c\x00\x05\x00\x06\x00\x0e\x00\x5b\x00\x2c\x00\x10\x00\x32\x00\x11\x00\x0e\x00\x60\x00\x5c\x00\x10\x00\xdc\xff\x11\x00\x0e\x00\x61\x00\x19\x00\x10\x00\x11\x00\x11\x00\x0e\x00\x58\x00\x64\x00\x10\x00\x62\x00\x11\x00\x0e\x00\x54\x00\x19\x00\x10\x00\x11\x00\x11\x00\x0e\x00\x55\x00\x5f\x00\x10\x00\x1a\x00\x11\x00\x0e\x00\x4b\x00\x60\x00\x10\x00\x53\x00\x11\x00\x0e\x00\x4c\x00\x5a\x00\x10\x00\x54\x00\x11\x00\x0e\x00\x4e\x00\x5b\x00\x10\x00\x57\x00\x11\x00\x0e\x00\x45\x00\x50\x00\x10\x00\x58\x00\x11\x00\x0e\x00\x46\x00\x44\x00\x10\x00\x51\x00\x11\x00\x0e\x00\x21\x00\x3f\x00\x10\x00\x11\x00\x11\x00\x40\x00\x0f\x00\x05\x00\x10\x00\x19\x00\x11\x00\x11\x00\x64\x00\x43\x00\x45\x00\x26\x00\x49\x00\x65\x00\x05\x00\x06\x00\x4d\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x05\x00\x06\x00\x34\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x05\x00\x06\x00\x37\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x05\x00\x06\x00\x3d\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x05\x00\x06\x00\x1d\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x05\x00\x06\x00\x24\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x05\x00\x06\x00\x07\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x05\x00\x06\x00\x05\x00\x06\x00\x30\x00\x0a\x00\x0b\x00\x2f\x00\x0b\x00\x05\x00\x06\x00\x48\x00\x4a\x00\x0e\x00\x31\x00\x0b\x00\x27\x00\x34\x00\x28\x00\x37\x00\x29\x00\x36\x00\x3d\x00\x3f\x00\xff\xff\x05\x00\x1d\x00\x20\x00\x21\x00\xff\xff\x05\x00\x24\x00\x26\x00\x2b\x00\x2a\x00\xff\xff\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"# +happyTable = HappyA# "\x00\x00\x12\x00\x0d\x00\x2d\x00\x0d\x00\x26\x00\x0d\x00\x1e\x00\x3d\x00\x28\x00\x5b\x00\x4f\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x05\x00\x40\x00\x39\x00\x3a\x00\x0e\x00\x05\x00\x0e\x00\x05\x00\x0e\x00\x05\x00\x0e\x00\x59\x00\x3d\x00\x10\x00\x3e\x00\x13\x00\x5a\x00\x15\x00\x05\x00\x06\x00\x2a\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x26\x00\x13\x00\x27\x00\x15\x00\x28\x00\x2d\x00\x48\x00\x05\x00\x06\x00\x2a\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x0e\x00\x0e\x00\x37\x00\x1a\x00\x0e\x00\x0e\x00\x2b\x00\x5e\x00\x5f\x00\x10\x00\x10\x00\x56\x00\x52\x00\x10\x00\x10\x00\x0e\x00\x0e\x00\x21\x00\x62\x00\x0e\x00\x0e\x00\xde\xff\x53\x00\x49\x00\x10\x00\x10\x00\x4a\x00\x4c\x00\x10\x00\x10\x00\x0e\x00\x0e\x00\x5d\x00\x5e\x00\x0e\x00\x0e\x00\x58\x00\x43\x00\x44\x00\x10\x00\x10\x00\x20\x00\x0f\x00\x10\x00\x10\x00\x05\x00\x06\x00\x4b\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x05\x00\x06\x00\x33\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x05\x00\x06\x00\x36\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x05\x00\x06\x00\x3b\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x05\x00\x06\x00\x1c\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x05\x00\x06\x00\x23\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x05\x00\x06\x00\x07\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x05\x00\x06\x00\x05\x00\x06\x00\x2f\x00\x0a\x00\x0b\x00\x2e\x00\x0b\x00\x05\x00\x06\x00\x59\x00\x18\x00\x62\x00\x30\x00\x0b\x00\x05\x00\x06\x00\x63\x00\x18\x00\x18\x00\x51\x00\x31\x00\x52\x00\x55\x00\x60\x00\x19\x00\x56\x00\x4e\x00\x4f\x00\x05\x00\x41\x00\x42\x00\x43\x00\x46\x00\x47\x00\x0e\x00\x25\x00\x33\x00\x48\x00\x36\x00\x35\x00\x3b\x00\x3d\x00\xff\xff\x1c\x00\x1f\x00\x20\x00\x05\x00\x00\x00\x05\x00\x23\x00\x25\x00\x2a\x00\x29\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x05\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"# -happyReduceArr = array (3, 45) [ +happyReduceArr = array (3, 43) [ (3 , happyReduce_3), (4 , happyReduce_4), (5 , happyReduce_5), @@ -184,13 +172,11 @@ happyReduceArr = array (3, 45) [ (40 , happyReduce_40), (41 , happyReduce_41), (42 , happyReduce_42), - (43 , happyReduce_43), - (44 , happyReduce_44), - (45 , happyReduce_45) + (43 , happyReduce_43) ] happy_n_terms = 26 :: Int -happy_n_nonterms = 18 :: Int +happy_n_nonterms = 16 :: Int happyReduce_3 = happySpecReduce_1 0# happyReduction_3 happyReduction_3 happy_x_1 @@ -227,7 +213,7 @@ happyReduction_7 happy_x_3 = case happyOut10 happy_x_1 of { happy_var_1 -> case happyOut10 happy_x_3 of { happy_var_3 -> happyIn9 - (mkFunTree "ELt" [([],[]),([],[0]),([],[1])] [ happy_var_1 , happy_var_3 ] + (mkFunTree "ELt" [([],[]),([],[]),([],[0]),([],[1])] [ happy_var_1 , happy_var_3 ] )}} happyReduce_8 = happySpecReduce_1 4# happyReduction_8 @@ -244,7 +230,7 @@ happyReduction_9 happy_x_3 = case happyOut10 happy_x_1 of { happy_var_1 -> case happyOut11 happy_x_3 of { happy_var_3 -> happyIn10 - (mkFunTree "EAdd" [([],[]),([],[0]),([],[1])] [ happy_var_1 , happy_var_3 ] + (mkFunTree "EAdd" [([],[]),([],[]),([],[0]),([],[1])] [ happy_var_1 , happy_var_3 ] )}} happyReduce_10 = happySpecReduce_3 4# happyReduction_10 @@ -254,7 +240,7 @@ happyReduction_10 happy_x_3 = case happyOut10 happy_x_1 of { happy_var_1 -> case happyOut11 happy_x_3 of { happy_var_3 -> happyIn10 - (mkFunTree "ESub" [([],[]),([],[0]),([],[1])] [ happy_var_1 , happy_var_3 ] + (mkFunTree "ESub" [([],[]),([],[]),([],[0]),([],[1])] [ happy_var_1 , happy_var_3 ] )}} happyReduce_11 = happySpecReduce_1 5# happyReduction_11 @@ -271,7 +257,7 @@ happyReduction_12 happy_x_3 = case happyOut11 happy_x_1 of { happy_var_1 -> case happyOut12 happy_x_3 of { happy_var_3 -> happyIn11 - (mkFunTree "EMul" [([],[]),([],[0]),([],[1])] [ happy_var_1 , happy_var_3 ] + (mkFunTree "EMul" [([],[]),([],[]),([],[0]),([],[1])] [ happy_var_1 , happy_var_3 ] )}} happyReduce_13 = happySpecReduce_3 6# happyReduction_13 @@ -290,7 +276,7 @@ happyReduction_14 (happy_x_4 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOut6 happy_x_1 of { happy_var_1 -> - case happyOut21 happy_x_3 of { happy_var_3 -> + case happyOut19 happy_x_3 of { happy_var_3 -> happyIn12 (mkFunTree "EApp" [([],[]),([],[]),([],[0]),([],[1])] [ happy_var_1 , happy_var_3 ] ) `HappyStk` happyRest}} @@ -440,123 +426,109 @@ happyReduction_27 (happy_x_6 `HappyStk` happyReduce_28 = happySpecReduce_1 8# happyReduction_28 happyReduction_28 happy_x_1 - = case happyOut16 happy_x_1 of { happy_var_1 -> - happyIn14 - (mkFunTree "TNum" [([],[0])] [ happy_var_1 ] - )} - -happyReduce_29 = happySpecReduce_1 9# happyReduction_29 -happyReduction_29 happy_x_1 - = case happyOut17 happy_x_1 of { happy_var_1 -> - happyIn15 - (mkFunTree "TNum" [([],[0])] [ happy_var_1 ] - )} - -happyReduce_30 = happySpecReduce_1 10# happyReduction_30 -happyReduction_30 happy_x_1 - = happyIn16 + = happyIn14 (mkFunTree "TFloat" [] [ ] ) -happyReduce_31 = happySpecReduce_1 10# happyReduction_31 -happyReduction_31 happy_x_1 - = happyIn16 +happyReduce_29 = happySpecReduce_1 8# happyReduction_29 +happyReduction_29 happy_x_1 + = happyIn14 (mkFunTree "TInt" [] [ ] ) -happyReduce_32 = happySpecReduce_1 11# happyReduction_32 -happyReduction_32 happy_x_1 - = happyIn17 +happyReduce_30 = happySpecReduce_1 9# happyReduction_30 +happyReduction_30 happy_x_1 + = happyIn15 (mkFunTree "TFloat" [] [ ] ) -happyReduce_33 = happySpecReduce_1 11# happyReduction_33 -happyReduction_33 happy_x_1 - = happyIn17 +happyReduce_31 = happySpecReduce_1 9# happyReduction_31 +happyReduction_31 happy_x_1 + = happyIn15 (mkFunTree "TInt" [] [ ] ) -happyReduce_34 = happySpecReduce_1 12# happyReduction_34 -happyReduction_34 happy_x_1 - = case happyOut23 happy_x_1 of { happy_var_1 -> - happyIn18 +happyReduce_32 = happySpecReduce_1 10# happyReduction_32 +happyReduction_32 happy_x_1 + = case happyOut21 happy_x_1 of { happy_var_1 -> + happyIn16 (mkFunTree "RecCons" [([],[]),([],[]),([[]],[]),([],[0])] [ happy_var_1 ] )} -happyReduce_35 = happySpecReduce_1 12# happyReduction_35 -happyReduction_35 happy_x_1 - = case happyOut23 happy_x_1 of { happy_var_1 -> - happyIn18 +happyReduce_33 = happySpecReduce_1 10# happyReduction_33 +happyReduction_33 happy_x_1 + = case happyOut21 happy_x_1 of { happy_var_1 -> + happyIn16 (mkFunTree "RecOne" [([],[]),([[]],[]),([],[0])] [ happy_var_1 ] )} -happyReduce_36 = happyReduce 4# 13# happyReduction_36 -happyReduction_36 (happy_x_4 `HappyStk` +happyReduce_34 = happyReduce 4# 11# happyReduction_34 +happyReduction_34 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOut15 happy_x_1 of { happy_var_1 -> case happyOut6 happy_x_2 of { happy_var_2 -> - case happyOut19 happy_x_4 of { happy_var_4 -> - happyIn19 + case happyOut17 happy_x_4 of { happy_var_4 -> + happyIn17 (mkFunTree "RecCons" [([],[0]),([],[]),([[1]],[2]),([],[])] [ happy_var_1 , happy_var_2 , happy_var_4 ] ) `HappyStk` happyRest}}} -happyReduce_37 = happySpecReduce_2 13# happyReduction_37 -happyReduction_37 happy_x_2 +happyReduce_35 = happySpecReduce_2 11# happyReduction_35 +happyReduction_35 happy_x_2 happy_x_1 = case happyOut15 happy_x_1 of { happy_var_1 -> case happyOut6 happy_x_2 of { happy_var_2 -> - happyIn19 + happyIn17 (mkFunTree "RecOne" [([],[0]),([[1]],[]),([],[])] [ happy_var_1 , happy_var_2 ] )}} -happyReduce_38 = happySpecReduce_1 14# happyReduction_38 -happyReduction_38 happy_x_1 +happyReduce_36 = happySpecReduce_1 12# happyReduction_36 +happyReduction_36 happy_x_1 = case happyOut13 happy_x_1 of { happy_var_1 -> - happyIn20 + happyIn18 (mkFunTree "RecOne" [([],[]),([[]],[0]),([],[])] [ happy_var_1 ] )} -happyReduce_39 = happySpecReduce_3 15# happyReduction_39 -happyReduction_39 happy_x_3 +happyReduce_37 = happySpecReduce_3 13# happyReduction_37 +happyReduction_37 happy_x_3 happy_x_2 happy_x_1 = case happyOut8 happy_x_1 of { happy_var_1 -> - case happyOut21 happy_x_3 of { happy_var_3 -> - happyIn21 + case happyOut19 happy_x_3 of { happy_var_3 -> + happyIn19 (mkFunTree "ConsExp" [([],[]),([],[]),([],[0]),([],[1])] [ happy_var_1 , happy_var_3 ] )}} -happyReduce_40 = happySpecReduce_1 15# happyReduction_40 -happyReduction_40 happy_x_1 +happyReduce_38 = happySpecReduce_1 13# happyReduction_38 +happyReduction_38 happy_x_1 = case happyOut8 happy_x_1 of { happy_var_1 -> - happyIn21 + happyIn19 (mkFunTree "OneExp" [([],[]),([],[0])] [ happy_var_1 ] )} -happyReduce_41 = happySpecReduce_2 16# happyReduction_41 -happyReduction_41 happy_x_2 +happyReduce_39 = happySpecReduce_2 14# happyReduction_39 +happyReduction_39 happy_x_2 happy_x_1 = case happyOut15 happy_x_1 of { happy_var_1 -> - case happyOut22 happy_x_2 of { happy_var_2 -> - happyIn22 + case happyOut20 happy_x_2 of { happy_var_2 -> + happyIn20 (mkFunTree "ConsTyp" [([],[0]),([],[1])] [ happy_var_1 , happy_var_2 ] )}} -happyReduce_42 = happySpecReduce_0 16# happyReduction_42 -happyReduction_42 = happyIn22 +happyReduce_40 = happySpecReduce_0 14# happyReduction_40 +happyReduction_40 = happyIn20 (mkFunTree "NilTyp" [] [ ] ) -happyReduce_43 = happySpecReduce_0 17# happyReduction_43 -happyReduction_43 = happyIn23 +happyReduce_41 = happySpecReduce_0 15# happyReduction_41 +happyReduction_41 = happyIn21 (mkFunTree "Empty" [] [ ] ) -happyReduce_44 = happyReduce 10# 17# happyReduction_44 -happyReduction_44 (happy_x_10 `HappyStk` +happyReduce_42 = happyReduce 10# 15# happyReduction_42 +happyReduction_42 (happy_x_10 `HappyStk` happy_x_9 `HappyStk` happy_x_8 `HappyStk` happy_x_7 `HappyStk` @@ -569,15 +541,15 @@ happyReduction_44 (happy_x_10 `HappyStk` happyRest) = case happyOut15 happy_x_1 of { happy_var_1 -> case happyOut6 happy_x_2 of { happy_var_2 -> - case happyOut19 happy_x_4 of { happy_var_4 -> - case happyOut20 happy_x_7 of { happy_var_7 -> - case happyOut18 happy_x_10 of { happy_var_10 -> - happyIn23 + case happyOut17 happy_x_4 of { happy_var_4 -> + case happyOut18 happy_x_7 of { happy_var_7 -> + case happyOut16 happy_x_10 of { happy_var_10 -> + happyIn21 (mkFunTree "Funct" [([],[]),([],[0]),([[1]],[2,3,4])] [ happy_var_1 , happy_var_2 , happy_var_4 , happy_var_7 , happy_var_10 ] ) `HappyStk` happyRest}}}}} -happyReduce_45 = happyReduce 9# 17# happyReduction_45 -happyReduction_45 (happy_x_9 `HappyStk` +happyReduce_43 = happyReduce 9# 15# happyReduction_43 +happyReduction_43 (happy_x_9 `HappyStk` happy_x_8 `HappyStk` happy_x_7 `HappyStk` happy_x_6 `HappyStk` @@ -590,8 +562,8 @@ happyReduction_45 (happy_x_9 `HappyStk` = case happyOut15 happy_x_1 of { happy_var_1 -> case happyOut6 happy_x_2 of { happy_var_2 -> case happyOut13 happy_x_6 of { happy_var_6 -> - case happyOut23 happy_x_9 of { happy_var_9 -> - happyIn23 + case happyOut21 happy_x_9 of { happy_var_9 -> + happyIn21 (mkFunTree "FunctNil" [([],[0]),([],[2]),([[1]],[3])] [ happy_var_1 , happy_var_2 , happy_var_6 , happy_var_9 ] ) `HappyStk` happyRest}}}} @@ -635,7 +607,7 @@ happyReturn = (returnM) happyThen1 m k tks = (thenM) m (\a -> k a tks) happyReturn1 = \a tks -> (returnM) a -pProgram tks = happyThen (happyParse 0# tks) (\x -> happyReturn (happyOut23 x)) +pProgram tks = happyThen (happyParse 0# tks) (\x -> happyReturn (happyOut21 x)) pStm tks = happyThen (happyParse 1# tks) (\x -> happyReturn (happyOut13 x)) @@ -655,7 +627,7 @@ happyError ts = myLexer = tokens {-# LINE 1 "GenericTemplate.hs" #-} --- $Id: ParImperC.hs,v 1.2 2004/11/09 19:12:51 aarne Exp $ +-- $Id: ParImperC.hs,v 1.3 2004/12/20 08:57:05 aarne Exp $ |
