Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
WebAssembly hello world
;; WebAssembly WASM AST Hello World! program
(module
(memory 1
(segment 8 "hello world!\n")
)
(import $__fwrite "env" "_fwrite" (param i32 i32 i32 i32) (result i32))
(import $_get__stdout "env" "get__stdout" (param) (result i32))
(export "main" $main)
(func $main (result i32)
(local $stdout i32)
(set_local $stdout (call_import $_get__stdout))
(return (call_import $__fwrite
(i32.const 8) ;; void *ptr => Address of our string
(i32.const 1) ;; size_t size => Data size
(i32.const 13) ;; size_t nmemb => Length of our string
(get_local $stdout)) ;; stream
)
)
)
@viniciusCamargo

hey, icefox! how are you doing? did you write somewhere about the setup necessary to run this script?

@icefox
Owner
icefox commented Aug 2, 2016 edited

See my blog entry that embeds this for how you can run it and more information: http://benjamin-meyer.blogspot.com/2016/07/webassembly-hello-world.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment