View Source :zigler (zigler v0.13.1)
Parse transform module for using Zigler with erlang.
For the canonical example, see: https://www.erlang.org/doc/man/erl_id_trans.html
Prerequisites
In order to use Zigler in an erlang project, you must have the Elixir runtime. You may do this any way you wish, but Zigler recommends rebar_mix:
https://github.com/Supersonido/rebar_mix
There are instructions on how to make sure Elixir is available at compile time for your erlang project.
Building a Zig Module
General documentation on parse transforms is very light. To use zigler as a parse transform:
-module(my_erlang_module).
-compile({parse_transform, zigler}).
-export([...]).
-zig_code("
pub fn hello_world() [] const u8 {
return "Hello, world!";
}
")
-zig_opts([{otp_app, my_app}]).
This creates the hello_world/0
function in your
module which returns the "Hello, world!" binary.
for options to be delivered in the zig_opts
attribute, see the
Zig
module documentation.
Note that the ...
for the nifs
option is not representable in erlang AST.
Instead, use the atom auto
.
Note
Erlang integration is highly experimental and the interface may be changed in the future.
Summary
Functions
performs a parse transformation on the AST for an erlang module, converting public functions in the
Types
@type foo() :: term()
foobarbaz
Functions
performs a parse transformation on the AST for an erlang module, converting public functions in the