1 {-# LANGUAGE OverloadedStrings #-}
4 import System.Environment
7 import qualified Data.ByteString.Lazy as B
14 import Mate.BasicBlocks
15 import Mate.X86CodeGen
16 import Mate.MethodPool
27 let bclspath = B.pack $ map (fromIntegral . ord) clspath
28 cls <- getClassFile bclspath
30 hmap <- parseMethod cls "main"
34 let methods = classMethods cls; methods :: [Method Resolved]
35 let method = find (\x -> (methodName x) == "main") methods
38 let mi = (MethodInfo "main" bclspath (methodSignature m))
39 entry <- compileBB hmap' mi
40 addMethodRef entry mi [bclspath]
41 printf "executing `main' now:\n"
43 Nothing -> error "main not found"
44 Nothing -> error "main not found"
45 _ -> error "Usage: mate <class-file>"