-
Notifications
You must be signed in to change notification settings - Fork 0
/
kc.hs
25 lines (24 loc) · 819 Bytes
/
kc.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import Data.List
import System.Environment
import System.IO
import System.Process
import UModuleLoader
import ULambdaExpression
import UCompile
import UOptimize
import qualified Data.Set as Set
main = do
args <- getArgs
let (ifname,ofname,outputc,target) = parseArg args ("","",False,"")
if null ifname || (not$isSuffixOf ".u" ifname) then
putStrLn "ucomp: ifname.u [-o ofname] [-c] [-is arch] "
else do
let basename = take (length ifname - 2) ifname
runCompile basename ofname outputc target
where
parseArg args (ifname,ofname,outputc,target) = case args of
[] -> (ifname,ofname,outputc,target)
("-o":f:r) -> parseArg r (ifname,f,outputc,target)
("-is":f:r) -> parseArg r (ifname,ofname,outputc,f)
("-c":r) -> parseArg r (ifname,ofname,True,target)
(f:r) -> parseArg r (f,ofname,outputc,target)