Changeset 5355 for src/Pugs/Compile

Show
Ignore:
Timestamp:
07/10/05 12:56:06 (3 years ago)
Author:
autrijus
svk:copy_cache_prev:
7349
Message:

* initial work for getting Compile Exp right (still a couple to be filled)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Compile/Pugs.hs

    r5266 r5355  
    6464                , text ("return (Pad " ++ show scope ++ " pad exp)") 
    6565                ] 
     66    compile (Pos pos exp) = compileShow2 "Pos" pos exp 
     67    compile (Cxt cxt exp) = compileShow2 "Cxt" cxt exp 
    6668    compile exp = return $ text "return" $+$ parens (text $ show exp) 
     69 
     70compileShow2 :: Show a => String -> a -> Exp -> Eval Doc 
     71compileShow2 con anno exp = do 
     72    expC <- compile exp 
     73    return $ prettyDo 
     74        [ prettyBind "exp" expC 
     75        , text ("return (" ++ con ++ " " ++ show anno ++ " exp)") 
     76        ] 
    6777 
    6878instance Compile Pad where 
     
    140150            $(liftM TH.ListE $  
    141151              mapM (\name -> [|(name, tshow $ 
    142                                 $(TH.varE $ TH.mkName name) code)|]) $ 
     152                                $(TH.varE $ TH.mkName name) code{ subEnv = Nothing })|]) $ 
    143153              ["isMulti", "subName", "subType", "subEnv", "subAssoc", 
    144154              "subParams", "subBindings", "subSlurpLimit", 
     
    151161#else  
    152162    compile code | subType code == SubPrim = return $ text "mkPrim" 
    153     compile code = return $ text $ show code 
     163    compile code = return $ text $ show code{ subType = Nothing } 
    154164#endif  
    155165