2 {-# LANGUAGE OverloadedStrings #-}
6 import System.Environment
9 import qualified Data.ByteString.Lazy as B
16 import Mate.BasicBlocks
17 import Mate.X86CodeGen
18 import Mate.MethodPool
29 let bclspath = B.pack $ map (fromIntegral . ord) clspath
30 cls <- getClassFile bclspath
31 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]
42 printf "executing `main' now:\n"
45 Nothing -> error "main not found"
46 Nothing -> error "main not found"
47 _ -> error "Usage: mate <class-file>"