Changeset 16627 for src/Pugs/CodeGen
- Timestamp:
- 06/04/07 10:08:30 (18 months ago)
- Location:
- src/Pugs/CodeGen
- Files:
-
- 5 modified
Legend:
- Unmodified
- Added
- Removed
-
src/Pugs/CodeGen/JSON.hs
r15297 r16627 8 8 import DrIFT.JSON 9 9 10 genJSON :: Eval Val 11 genJSON = do 10 -- XXX: do something useful with the filename arg 11 genJSON :: FilePath -> Eval Val 12 genJSON _ = do 12 13 penv <- compile () :: Eval PIL_Environment 13 14 return . VStr . unlines $ [showJSON penv] -
src/Pugs/CodeGen/PIL1.hs
r15297 r16627 7 7 import Pugs.Compile 8 8 9 genPIL1 :: Eval Val10 genPIL1 = do9 genPIL1 :: FilePath -> Eval Val 10 genPIL1 _ = do 11 11 penv <- compile () 12 12 return . VStr . unlines $ -
src/Pugs/CodeGen/PIR.hs
r15651 r16627 370 370 varInit x = internalError $ "Invalid name: " ++ x 371 371 372 genPIR_YAML :: Eval Val 373 genPIR_YAML = genPIRWith $ \globPIR mainPIR _ -> do 372 -- XXX: do something useful with the filename arg 373 genPIR_YAML :: FilePath -> Eval Val 374 genPIR_YAML _ = genPIRWith $ \globPIR mainPIR _ -> do 374 375 yaml <- io (showYaml (mainPIR, globPIR)) 375 376 return (VStr yaml) 376 377 377 378 {-| Compiles the current environment to PIR code. -} 378 genPIR :: Eval Val379 genPIR = genPIRWith $ \globPIR mainPIR penv -> do379 genPIR :: FilePath -> Eval Val 380 genPIR file = genPIRWith $ \globPIR mainPIR penv -> do 380 381 libs <- io $ getLibs 381 382 return . VStr . unlines $ 382 383 [ "#!/usr/bin/env parrot" 384 , "# " ++ file 383 385 , renderStyle (Style PageMode 0 0) $ preludePIR $+$ vcat 384 386 -- Namespaces have bugs in both pugs and parrot. -
src/Pugs/CodeGen/Perl5.hs
r15297 r16627 8 8 import DrIFT.Perl5 9 9 10 genPerl5 :: Eval Val 11 genPerl5 = do 10 -- XXX: do something useful with the filename arg 11 genPerl5 :: FilePath -> Eval Val 12 genPerl5 _ = do 12 13 penv <- compile () :: Eval PIL_Environment 13 14 return . VStr . unlines $ [showPerl5 penv] -
src/Pugs/CodeGen/YAML.hs
r15753 r16627 9 9 import DrIFT.YAML 10 10 11 genParseHsYAML, genParseYAML :: Eval Val12 genParseHsYAML = doGenParseYAML(fmap show . toYamlNode)13 genParseYAML = doGenParseYAMLshowYamlCompressed11 genParseHsYAML, genParseYAML :: FilePath -> Eval Val 12 genParseHsYAML file = doGenParseYAML file (fmap show . toYamlNode) 13 genParseYAML file = doGenParseYAML file showYamlCompressed 14 14 15 doGenParseYAML :: (CompUnit -> IO String) -> Eval Val16 doGenParseYAML f = do15 doGenParseYAML :: FilePath -> (CompUnit -> IO String) -> Eval Val 16 doGenParseYAML file f = do 17 17 pad <- filterPrim =<< asks envGlobal 18 18 main <- asks envBody 19 yaml <- io $ f $ mkCompUnit "<unused>"pad main19 yaml <- io $ f $ mkCompUnit file pad main 20 20 return $ VStr yaml 21 21 22 genYAML :: Eval Val 23 genYAML = do 22 -- XXX: do something useful with the filename arg 23 genYAML :: FilePath -> Eval Val 24 genYAML _ = do 24 25 penv <- compile () :: Eval PIL_Environment 25 26 yaml <- io (showYamlCompressed penv)
