This commit is contained in:
msyds committed 2026-07-12 12:33:46 -06:00
1 parent fdf3064665
commit 4522e455dd
6 files changed
+128 -29

No files matched your search

+6 -1
View File
@@ -31,7 +31,8 @@ import qualified Data.Vector.Strict as V
import Data.IntMap.Strict (IntMap)
import Data.String.Interpolate
import Gyehoek.Wasm qualified as Wasm
import Gyehoek.Wasm (i32, ins, sxp, eq, ref, i31)
import Gyehoek.Wasm (i32, ins, sxp, eq, ref, i31, Type (..))
import Language.Sexp.Located (pattern ParenList)
data Env = MkEnv { vars :: Vector Name }
@@ -103,8 +104,12 @@ lowerBinOp op g x y r e =
scm = ref eq
lower :: Exp -> Eff es Text
lower e = fmap Wasm.renderModule . Wasm.execGenMod $ do
Wasm.deftypeNamed "$heap-object" $ Wasm.sub [] $ Wasm.struct
[ Wasm.mut i32 ]
main <- Wasm.defun [] [scm] [scm, scm, scm, scm, scm] \_ ->
lower' emptyEnv e
Wasm.export "main" "func" main