+buildAST (Function (Prototype nameStr paramStrs) body) = do
+ let n = fromString nameStr
+ function n params Type.double $ \ops -> do
+ let binds = Map.fromList (zip paramStrs ops)
+ flip runReaderT binds $ buildExpr body >>= ret
+ where params = zip (repeat Type.double) (map fromString paramStrs)
+
+buildAST (Extern (Prototype nameStr params)) =
+ extern (fromString nameStr) (replicate (length params) Type.double) Type.double
+