Home

Work in progress!

This documentation (and the entire package) is a work in progress.

Public functions

WebAssemblyText.jl2watFunction
jl2wat(path::AbstractString)

Convert contents of a julia source code file to WebAssembly text.

Examples

julia> using WebAssemblyText
julia> wat = jl2wat("example.jl")
julia> println(wat)
source
WebAssemblyText.jlstring2watFunction
jlstring2wat(str::AbstractString)

Convert a string of julia source code to WebAssembly text.

Examples

julia> using WebAssemblyText
julia> str="
hello(x) = 2.0*x
hello(1.0)
";
julia> wat = jlstring2wat(str);
julia> println(wat)
(module 

(func $hello (export "hello") (param $x f32) (result f32)
( return ( f32.mul (f32.const 2.0) (local.get $x) ) ))
)
source
WebAssemblyText.@code_watMacro
@code_wat expression

Macro for translating a single function without adding on imports and builtins.

Examples

julia> hello(x) = 3.1*x
julia> @code_wat hello(1.2)

(func $hello (export "hello") (param $x f32) (result f32) 
(return (f32.mul (f32.const 3.1) (local.get $x))))
source