;; Auto-generated by speckl-compile from ToggleSwitch ;; Compile: wat2wasm ToggleSwitch.wat -o ToggleSwitch.wasm (module ;; Host imports for Map/Set/alloc (import "speckl" "map_create" (func $map_create (result i32))) (import "speckl" "map_set" (func $map_set (param i32 i32 i32))) (import "speckl" "map_get" (func $map_get (param i32 i32) (result i32))) (import "speckl" "map_has" (func $map_has (param i32 i32) (result i32))) (import "speckl" "map_remove" (func $map_remove (param i32 i32))) (import "speckl" "set_create" (func $set_create (result i32))) (import "speckl" "set_add" (func $set_add (param i32 i32))) (import "speckl" "set_has" (func $set_has (param i32 i32) (result i32))) (import "speckl" "set_size" (func $set_size (param i32) (result i32))) (import "speckl" "alloc" (func $alloc (param i32) (result i32))) (import "speckl" "write_i32" (func $write_i32 (param i32 i32))) (import "speckl" "write_f64" (func $write_f64 (param i32 f64))) ;; Linear memory (exported so host can read state) (memory (export "memory") 1) ;; State globals (global $isOn (mut i32) (i32.const 0)) ;; ---- init ---- (func $init (export "init") (i32.const 0) (global.set $isOn) ) ;; ---- Actions ---- ;; action: TurnOn (func $TurnOn (export "TurnOn") (result i32) ;; require: not isOn ;; Complex guard not compiled: not isOn ;; isOn := true (i32.const 0) ;; uncompiled expr: true (global.set $isOn) (global.get $isOn) (return) ) ;; action: TurnOff (func $TurnOff (export "TurnOff") (result i32) ;; require: isOn ;; Complex guard not compiled: isOn ;; isOn := false (i32.const 0) ;; uncompiled expr: false (global.set $isOn) (global.get $isOn) (return) ) ;; ---- getState ---- (func $getState (export "getState") (result i32 i32) (i32.const 0) (global.get $isOn) (i32.store) (i32.const 0) (i32.const 4) ) ;; checkConstraints — runtime constraint evaluation stub (func $checkConstraints (export "checkConstraints") (result i32) ;; TODO: evaluate constraint expressions at runtime (i32.const 1) ) )