Add the first post in CS325 series

This commit is contained in:
2019-12-29 22:47:36 -08:00
parent a406fb0846
commit 19aa126025
3 changed files with 269 additions and 43 deletions

View File

@@ -270,14 +270,13 @@ type Translator = Control.Monad.State.State (Map.Map String [String], Int)
currentTemp :: Translator String
currentTemp = do
(_, t) <- get
t <- gets snd
return $ "temp" ++ show t
incrementTemp :: Translator String
incrementTemp = do
(vs, t) <- get
put (vs, t+1)
return $ "temp" ++ show t
modify (second (+1))
currentTemp
hasLambda :: Expr -> Bool
hasLambda (ListLiteral es) = any hasLambda es