module Gyehoek.Stack.Lower ( lowerProgram ) where import Gyehoek.Stack.Syntax import Gyehoek.Wasm qualified as Wasm import Gyehoek.Prelude import Gyehoek.Wasm (wat, watM) lowerRoutine :: Routine -> Wasm.Function lowerRoutine rt = _ lowerBlock :: Block -> Wasm.Expr lowerBlock = _ lowerInstr :: Instr -> Wasm.Expr lowerInstr = \case -- PopCont ktail -> [wat| -- |] lowerProgram :: Program -> Eff es Wasm.Module lowerProgram p = pure [watM| (module ##{rs}) |] where rs = p ^.. #routines . each . to lowerRoutine