module FreeC.Backend.Coq.Converter.FuncDecl.NonRec
( convertNonRecFuncDecl
, convertNonRecFuncDecls
) where
import FreeC.Backend.Coq.Converter.Expr
import FreeC.Backend.Coq.Converter.FuncDecl.Common
import qualified FreeC.Backend.Coq.Syntax as Coq
import FreeC.IR.DependencyGraph
import qualified FreeC.IR.Syntax as IR
import FreeC.Monad.Converter
convertNonRecFuncDecls :: [IR.FuncDecl] -> Converter [Coq.Sentence]
convertNonRecFuncDecls decls = do
let decls' = concatMap unwrapComponent (valueDependencyComponents decls)
mapM convertNonRecFuncDecl decls'
convertNonRecFuncDecl :: IR.FuncDecl -> Converter Coq.Sentence
convertNonRecFuncDecl funcDecl = localEnv $ do
(qualid, binders, returnType') <- convertFuncHead funcDecl
rhs' <- convertExpr (IR.funcDeclRhs funcDecl)
return (Coq.definitionSentence qualid binders returnType' rhs')