Changeset 2750 for src/Main.hs
- Timestamp:
- 05/05/05 22:20:07 (4 years ago)
- svk:copy_cache_prev:
- 4271
- Files:
-
- 1 modified
-
src/Main.hs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Main.hs
r2725 r2750 65 65 run ("-c":file:_) = readFile file >>= doCheck file 66 66 67 run ("-C":backend:"-e":prog:_) = doCompile backend "-e" prog 68 run ("-C":backend:file:_) = readFile file >>= doCompile backend file 67 run ("-C":backend:"-e":prog:_) = doCompileDump backend "-e" prog 68 run ("-C":backend:file:_) = readFile file >>= doCompileDump backend file 69 70 run ("-B":backend:"-e":prog:_) = doCompileRun backend "-e" prog 71 run ("-B":backend:file:_) = readFile file >>= doCompileRun backend file 72 69 73 run ("--external":mod:"-e":prog:_) = doExternal mod "-e" prog 70 74 run ("--external":mod:file:_) = readFile file >>= doExternal mod file … … 130 134 putStrLn str 131 135 132 doCompile :: [Char] -> FilePath -> String -> IO ()136 doCompile :: [Char] -> FilePath -> String -> IO String 133 137 doCompile backend = doParseWith $ \env _ -> do 134 138 globRef <- liftSTM $ do 135 139 glob <- readTVar $ envGlobal env 136 140 newTVar $ userDefined glob 137 str <- compile backend env{ envGlobal = globRef } 141 compile backend env{ envGlobal = globRef } 142 143 doCompileDump :: [Char] -> FilePath -> String -> IO () 144 doCompileDump backend file prog = do 145 str <- doCompile backend file prog 138 146 writeFile "dump.ast" str 147 148 doCompileRun :: [Char] -> FilePath -> String -> IO () 149 doCompileRun backend file prog = do 150 str <- doCompile backend file prog 151 evalEmbedded backend str 139 152 140 153 doParseWith :: (Env -> FilePath -> IO a) -> FilePath -> String -> IO a
