Changeset 16627 for src/Pugs/CodeGen

Show
Ignore:
Timestamp:
06/04/07 10:08:30 (18 months ago)
Author:
gaal
Message:

* reintroduce the description field in CompUnit?, and chase codeGens

to use the filename where possible.
You may need to "rm blib6/lib/*yml" with this revision.
TODO: think about adding a parser revision number to the compunit

Location:
src/Pugs/CodeGen
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/CodeGen/JSON.hs

    r15297 r16627  
    88import DrIFT.JSON 
    99 
    10 genJSON :: Eval Val 
    11 genJSON = do 
     10-- XXX: do something useful with the filename arg 
     11genJSON :: FilePath -> Eval Val 
     12genJSON _ = do 
    1213    penv <- compile () :: Eval PIL_Environment 
    1314    return . VStr . unlines $ [showJSON penv] 
  • src/Pugs/CodeGen/PIL1.hs

    r15297 r16627  
    77import Pugs.Compile 
    88 
    9 genPIL1 :: Eval Val 
    10 genPIL1 = do 
     9genPIL1 :: FilePath -> Eval Val 
     10genPIL1 _ = do 
    1111    penv <- compile () 
    1212    return . VStr . unlines $ 
  • src/Pugs/CodeGen/PIR.hs

    r15651 r16627  
    370370varInit x       = internalError $ "Invalid name: " ++ x 
    371371 
    372 genPIR_YAML :: Eval Val 
    373 genPIR_YAML = genPIRWith $ \globPIR mainPIR _ -> do 
     372-- XXX: do something useful with the filename arg 
     373genPIR_YAML :: FilePath -> Eval Val 
     374genPIR_YAML _ = genPIRWith $ \globPIR mainPIR _ -> do 
    374375    yaml <- io (showYaml (mainPIR, globPIR)) 
    375376    return (VStr yaml) 
    376377 
    377378{-| Compiles the current environment to PIR code. -} 
    378 genPIR :: Eval Val 
    379 genPIR = genPIRWith $ \globPIR mainPIR penv -> do 
     379genPIR :: FilePath -> Eval Val 
     380genPIR file = genPIRWith $ \globPIR mainPIR penv -> do 
    380381    libs        <- io $ getLibs 
    381382    return . VStr . unlines $ 
    382383        [ "#!/usr/bin/env parrot" 
     384        , "# " ++ file 
    383385        , renderStyle (Style PageMode 0 0) $ preludePIR $+$ vcat 
    384386        -- Namespaces have bugs in both pugs and parrot. 
  • src/Pugs/CodeGen/Perl5.hs

    r15297 r16627  
    88import DrIFT.Perl5 
    99 
    10 genPerl5 :: Eval Val 
    11 genPerl5 = do 
     10-- XXX: do something useful with the filename arg 
     11genPerl5 :: FilePath -> Eval Val 
     12genPerl5 _ = do 
    1213    penv <- compile () :: Eval PIL_Environment 
    1314    return . VStr . unlines $ [showPerl5 penv] 
  • src/Pugs/CodeGen/YAML.hs

    r15753 r16627  
    99import DrIFT.YAML 
    1010 
    11 genParseHsYAML, genParseYAML :: Eval Val 
    12 genParseHsYAML = doGenParseYAML (fmap show . toYamlNode) 
    13 genParseYAML   = doGenParseYAML showYamlCompressed 
     11genParseHsYAML, genParseYAML :: FilePath -> Eval Val 
     12genParseHsYAML file = doGenParseYAML file (fmap show . toYamlNode) 
     13genParseYAML   file = doGenParseYAML file showYamlCompressed 
    1414 
    15 doGenParseYAML :: (CompUnit -> IO String) -> Eval Val 
    16 doGenParseYAML f = do 
     15doGenParseYAML :: FilePath -> (CompUnit -> IO String) -> Eval Val 
     16doGenParseYAML file f = do 
    1717    pad  <- filterPrim =<< asks envGlobal 
    1818    main <- asks envBody 
    19     yaml <- io $ f $ mkCompUnit "<unused>" pad main 
     19    yaml <- io $ f $ mkCompUnit file pad main 
    2020    return $ VStr yaml 
    2121 
    22 genYAML :: Eval Val 
    23 genYAML = do 
     22-- XXX: do something useful with the filename arg 
     23genYAML :: FilePath -> Eval Val 
     24genYAML _ = do 
    2425    penv <- compile () :: Eval PIL_Environment 
    2526    yaml <- io (showYamlCompressed penv)