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