Changeset 2750 for src/Main.hs

Show
Ignore:
Timestamp:
05/05/05 22:20:07 (4 years ago)
Author:
autrijus
svk:copy_cache_prev:
4271
Message:

* pugs -BParrot examples/mandel.p6

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Main.hs

    r2725 r2750  
    6565run ("-c":file:_)               = readFile file >>= doCheck file 
    6666 
    67 run ("-C":backend:"-e":prog:_)           = doCompile backend "-e" prog 
    68 run ("-C":backend:file:_)                = readFile file >>= doCompile backend file 
     67run ("-C":backend:"-e":prog:_)           = doCompileDump backend "-e" prog 
     68run ("-C":backend:file:_)                = readFile file >>= doCompileDump backend file 
     69 
     70run ("-B":backend:"-e":prog:_)           = doCompileRun backend "-e" prog 
     71run ("-B":backend:file:_)                = readFile file >>= doCompileRun backend file 
     72 
    6973run ("--external":mod:"-e":prog:_)    = doExternal mod "-e" prog 
    7074run ("--external":mod:file:_)         = readFile file >>= doExternal mod file 
     
    130134    putStrLn str 
    131135 
    132 doCompile :: [Char] -> FilePath -> String -> IO () 
     136doCompile :: [Char] -> FilePath -> String -> IO String 
    133137doCompile backend = doParseWith $ \env _ -> do 
    134138    globRef <- liftSTM $ do 
    135139        glob <- readTVar $ envGlobal env 
    136140        newTVar $ userDefined glob 
    137     str     <- compile backend env{ envGlobal = globRef } 
     141    compile backend env{ envGlobal = globRef } 
     142 
     143doCompileDump :: [Char] -> FilePath -> String -> IO () 
     144doCompileDump backend file prog = do 
     145    str <- doCompile backend file prog 
    138146    writeFile "dump.ast" str 
     147 
     148doCompileRun :: [Char] -> FilePath -> String -> IO () 
     149doCompileRun backend file prog = do 
     150    str <- doCompile backend file prog 
     151    evalEmbedded backend str 
    139152 
    140153doParseWith :: (Env -> FilePath -> IO a) -> FilePath -> String -> IO a