Changeset 22313 for src/Pugs/Compile.hs

Show
Ignore:
Timestamp:
09/22/08 19:30:53 (2 months ago)
Author:
pmurias
Message:

[pugs][smop]
lexical variable work in pugs -Cm0ld
Pugs.Compile.compile marks lexical delarations in PIL1 although not fully correctly

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Compile.hs

    r21930 r22313  
    2626import Language.PIR 
    2727import Text.PrettyPrint 
     28import qualified Data.ByteString.Char8 as BS 
    2829 
    2930tcVoid, tcLValue :: TCxt 
     
    384385_PVar = PVar . cast 
    385386 
     387addPad stmt entry = PPad{pStmts=stmt,pScope=SMy,pSyms=[((BS.unpack $ cast $ fst entry),PRawName "...")]} 
    386388{-| Compiles various 'Exp's to 'PIL_Expr's. -} 
    387389instance Compile Exp PIL_Expr where 
     
    399401        bodyC   <- compile body 
    400402        return $ PExp $ PApp cxt (pBlock bodyC) Nothing [] 
    401     compile (Syn "sub" [Val (VCode sub)]) = do 
     403    compile (Syn "sub" [Val (VCode sub)]) =  do 
    402404        bodyC   <- enter sub $ compile $ case subBody sub of 
    403405            Syn "block" [exp]   -> exp 
    404406            exp                 -> exp 
    405407        paramsC <- compile $ subParams sub 
    406         return $ PCode (subType sub) paramsC (subLValue sub) (isMulti sub) bodyC 
     408        return $ PCode (subType sub) paramsC (subLValue sub) (isMulti sub) (foldl addPad bodyC (padToList $ subInnerPad sub)) 
    407409    compile (Syn "module" _) = compile Noop 
    408410    compile (Syn "match" exp) = compile $ Syn "rx" exp -- wrong