From: Matthijs Kooijman Date: Thu, 29 Jan 2009 16:43:32 +0000 (+0100) Subject: Learn expandExpr how to handle Let expressions. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=ae1328b9d0650254a02556466961749b528a6d7a;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git Learn expandExpr how to handle Let expressions. --- diff --git a/Translator.hs b/Translator.hs index 6fa043c..338d16f 100644 --- a/Translator.hs +++ b/Translator.hs @@ -227,6 +227,16 @@ expandExpr binds (Var id) = (error $ "Argument " ++ getOccString id ++ "is unknown") (lookup id binds) +expandExpr binds l@(Let (NonRec b bexpr) expr) = do + (signal_decls, statements, arg_signals, res_signals) <- expandExpr binds bexpr + let binds' = (b, res_signals) : binds + (signal_decls', statements', arg_signals', res_signals') <- expandExpr binds' expr + return ( + signal_decls ++ signal_decls', + statements ++ statements', + arg_signals', + res_signals') + expandExpr binds app@(App _ _) = do let ((Var f), args) = collectArgs app if isTupleConstructor f