diff options
| author | Henry Gressmann <mail@henrygressmann.de> | 2023-12-06 14:55:53 +0100 |
|---|---|---|
| committer | Henry Gressmann <mail@henrygressmann.de> | 2023-12-06 14:55:53 +0100 |
| commit | 7d167c2fadb370a33dd65b387dbab9d053f103a9 (patch) | |
| tree | bafe2524446b5288aabc273cf6ee9494b7c42a07 /examples | |
| parent | 5f928b74d20717342074bb29797c97d75120c21f (diff) | |
feat: cli now has options to specify arguments and function to run
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/wasm/loop.wat | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/examples/wasm/loop.wat b/examples/wasm/loop.wat new file mode 100644 index 0000000..27c6d2e --- /dev/null +++ b/examples/wasm/loop.wat @@ -0,0 +1,20 @@ +(module + (func $loopExample (export "loopExample") + (local i32) ;; Declare a local i32 variable, let's call it 'i' + (i32.const 0) ;; Initialize 'i' to 0 + (local.set 0) + + (loop $loopStart ;; Start of the loop + (local.get 0) ;; Get the current value of 'i' + (i32.const 1) ;; Push 1 onto the stack + (i32.add) ;; Add 'i' and 1 + (local.set 0) ;; Update 'i' with the new value + + (local.get 0) ;; Push the current value of 'i' to check the condition + (i32.const 10) ;; Push 10 onto the stack + (i32.lt_s) ;; Check if 'i' is less than 10 + (br_if $loopStart) ;; If 'i' < 10, continue the loop + ) + ) +) + |
