Niffler.compile

You're seeing just the function compile, go back to Niffler module for more information.
Link to this function

compile(code, inputs, outputs)

View Source

Low level function takes a string as input and compiles it into a nif program. Returning the program reference. Prefer using the high-level function Niffler.defnif/4 or Niffler.Library instead.

Examples

iex> {:ok, prog} = Niffler.compile("$ret = $a * $b;", [a: :int, b: :int], [ret: :int])
iex> Niffler.run(prog, [3, 4])
{:ok, [12]}

iex> code = "for (int i = 0; i < $str.size; i++) if ($str.data[i] == 0) $ret++;"
iex> {:ok, prog} = Niffler.compile(code, [str: :binary], [ret: :int])
iex> Niffler.run(prog, [<<0,1,1,0,1,5,0>>])
{:ok, [3]}