2 {-# LANGUAGE OverloadedStrings #-}
5 import System.Environment
8 import qualified Data.ByteString.Lazy as B
17 import Mate.BasicBlocks
18 import Mate.X86CodeGen
19 import Mate.MethodPool
30 let bclspath = B.pack $ map (fromIntegral . ord) clspath
31 cls <- getClassFile bclspath
35 hmap <- parseMethod cls "main"
38 let methods = classMethods cls; methods :: [Method Resolved]
39 let method = find (\x -> (methodName x) == "main") methods
42 let mi = (MethodInfo "main" bclspath (methodSignature m))
43 entry <- compileBB hmap' mi
44 addMethodRef entry mi [bclspath]
46 printf "executing `main' now:\n"
49 Nothing -> error "main not found"
50 Nothing -> error "main not found"
51 _ -> error "Usage: mate <class-file>"