Changeset 15296 for src/Pugs/CodeGen
- Timestamp:
- 02/18/07 15:56:10 (21 months ago)
- Location:
- src/Pugs/CodeGen
- Files:
-
- 6 modified
Legend:
- Unmodified
- Added
- Removed
-
src/Pugs/CodeGen/JSON.hs
r13448 r15296 11 11 genJSON = do 12 12 penv <- compile () :: Eval PIL_Environment 13 return . VStr . unlines $ [showJSON penv]13 return . _VStr . unlines $ [showJSON penv] -
src/Pugs/CodeGen/PIL1.hs
r13448 r15296 10 10 genPIL1 = do 11 11 penv <- compile () 12 return . VStr . unlines $12 return . _VStr . unlines $ 13 13 [ "PIL_Environment" 14 14 , " { pilMain = (" ++ show (pilMain penv) ++ ")" -
src/Pugs/CodeGen/PIL2.hs
r10059 r15296 17 17 genPIL2 = do 18 18 penv <- compile () 19 return . VStr . unlines $19 return . _VStr . unlines $ 20 20 [ "PIL_Environment" 21 21 , " { pilMain = (" ++ show (pilMain penv) ++ ")" … … 27 27 genPIL2Perl5 = do 28 28 penv <- compile () :: Eval PIL_Environment 29 return . VStr . unlines $ [showPerl5 penv]29 return . _VStr . unlines $ [showPerl5 penv] 30 30 31 31 genPIL2JSON :: Eval Val 32 32 genPIL2JSON = do 33 33 penv <- compile () :: Eval PIL_Environment 34 return . VStr . unlines $ [showJSON penv]34 return . _VStr . unlines $ [showJSON penv] 35 35 36 36 genPIL2YAML :: Eval Val … … 38 38 penv <- compile () :: Eval PIL_Environment 39 39 yaml <- liftIO (showYaml penv) 40 return . VStr . unlines $ [yaml]40 return . _VStr . unlines $ [yaml] -
src/Pugs/CodeGen/PIR.hs
r13614 r15296 162 162 instance Translate PIL_Literal Expression where 163 163 trans (PVal (VBool bool)) = return $ ExpLit (LitInt (toInteger $ fromEnum bool)) 164 trans (PVal (VStr str)) = return $ ExpLit (LitStr str)164 trans (PVal (VStr str)) = return $ ExpLit (LitStr (cast str)) 165 165 trans (PVal (VInt int)) = return $ ExpLit (LitInt int) 166 166 trans (PVal (VNum num)) = return $ ExpLit (LitNum num) … … 168 168 -- trans (PVal (VList [])) = return $ LitInt 0 -- XXX Wrong 169 169 trans (PVal (VCode code)) 170 | MkCode{ subBody = Syn "block" [ Ann _ exp ] } <- code 170 | MkCode{ subBody = Syn syn [ Ann _ exp ] } <- code 171 , syn == cast "block" 171 172 , App (Var var) Nothing [] <- exp 172 173 = fmap ExpLV (trans (PVar $ cast var)) … … 373 374 genPIR_YAML = genPIRWith $ \globPIR mainPIR _ -> do 374 375 yaml <- liftIO (showYaml (mainPIR, globPIR)) 375 return ( VStr yaml)376 return (_VStr yaml) 376 377 377 378 {-| Compiles the current environment to PIR code. -} … … 379 380 genPIR = genPIRWith $ \globPIR mainPIR penv -> do 380 381 libs <- liftIO $ getLibs 381 return . VStr . unlines $382 return . _VStr . unlines $ 382 383 [ "#!/usr/bin/env parrot" 383 384 , renderStyle (Style PageMode 0 0) $ preludePIR $+$ vcat -
src/Pugs/CodeGen/Perl5.hs
r13448 r15296 11 11 genPerl5 = do 12 12 penv <- compile () :: Eval PIL_Environment 13 return . VStr . unlines $ [showPerl5 penv]13 return . _VStr . unlines $ [showPerl5 penv] -
src/Pugs/CodeGen/YAML.hs
r10762 r15296 18 18 main <- asks envBody 19 19 yaml <- liftIO $ f $ mkCompUnit "<unused>" pad main 20 return $ VStr yaml20 return $ _VStr yaml 21 21 22 22 genYAML :: Eval Val … … 24 24 penv <- compile () :: Eval PIL_Environment 25 25 yaml <- liftIO (showYaml penv) 26 return $ VStr yaml26 return $ _VStr yaml
