Packages
WebAssembly is a web DSL for Elixir. You create html structure straight using do blocks. Means, you can intermix html-building blocks with full Elixir syntax. DSL output is an iolist, which you can flatten to string, but better use is to just feed it to the socket (via Plug & Cowboy). WebAssem...
Current section
Files
Jump to
Current section
Files
lib/core.ex
alias WebAssembly.Core
defmodule Core do
defmodule St do
require WebAssembly.Types, as: T
defstruct stack: []
@type t :: %St{stack: [T.content]}
@spec new() :: t
def new, do: %__MODULE__{}
@spec push(t, T.content) :: t
def push(st = %{stack: s}, elem) do
%{st | stack: [elem|s]}
end
@spec release(t) :: [T.content]
def release(%{stack: s}), do: Enum.reverse(s)
end
end