Module ale_call

ale_call - Erlang interface to the Aleph Rust compiler binary.

Description

ale_call - Erlang interface to the Aleph Rust compiler binary

This module provides functions to convert Aleph ASTs (in Erlang terms) into JSON and call the Rust Aleph compiler to generate code. It supports configuring the Rust binary path and specifying output type. -------------------------------------------------------------------

Function Index

call_rust_generator_direct/1Call Rust compiler using OS command, piping the JSON AST via echo and reading output.
call_rust_generator_direct/2
call_rust_generator_port/1Call Rust compiler using Erlang port for better IO control.
call_rust_generator_port/2
check_rust_generator/0Check if the Rust Aleph compiler executable exists and is a file.
diagnostic_info/0Print diagnostic information about the Rust compiler configuration.
generate/1Generate code from an Aleph AST.
generate/2Generate code from an Aleph AST with specified output type.
generate_from_file/1Generate code from a JSON file.
generate_from_file/2Generate code from a JSON file with specified output type.
get_rust_generator_path/0Get the Rust Aleph compiler executable path.
set_rust_generator_path/1Set the file path of the Rust Aleph compiler executable.

Function Details

call_rust_generator_direct/1

call_rust_generator_direct(JsonAST) -> any()

Call Rust compiler using OS command, piping the JSON AST via echo and reading output. Defaults to output type "ale". -spec call_rust_generator_direct(binary() | string()) -> {ok,binary()} | {error,term()} -spec call_rust_generator_direct(binary() | string(), string()) -> {ok,binary()} | {error,term()} ===================================================================

call_rust_generator_direct/2

call_rust_generator_direct(JsonAST, OutputType) -> any()

call_rust_generator_port/1

call_rust_generator_port(JsonAST) -> any()

Call Rust compiler using Erlang port for better IO control. Sends compact single-line JSON, receives output from stdout. Defaults to output type "ale". -spec call_rust_generator_port(binary() | string()) -> {ok,binary()} | {error,term()} -spec call_rust_generator_port(binary() | string(), string()) -> {ok,binary()} | {error,term()} ===================================================================

call_rust_generator_port/2

call_rust_generator_port(JsonAST, OutputType) -> any()

check_rust_generator/0

check_rust_generator() -> any()

Check if the Rust Aleph compiler executable exists and is a file. Returns {ok, Path} or {error, not_found}. -spec check_rust_generator() -> {ok,string()} | {error,not_found} ===================================================================

diagnostic_info/0

diagnostic_info() -> any()

Print diagnostic information about the Rust compiler configuration. -spec diagnostic_info() -> ok ===================================================================

generate/1

generate(AlephAST) -> any()

Generate code from an Aleph AST. Uses "ale" as the default output type. -spec generate(term()) -> {ok,binary()} | {error,term()} ===================================================================

generate/2

generate(AlephAST, OutputType) -> any()

Generate code from an Aleph AST with specified output type. -spec generate(term(), string()) -> {ok,binary()} | {error,term()} ===================================================================

generate_from_file/1

generate_from_file(JsonFile) -> any()

Generate code from a JSON file. Uses "ale" as the default output type. -spec generate_from_file(string()) -> {ok,binary()} | {error,term()} ===================================================================

generate_from_file/2

generate_from_file(JsonFile, OutputType) -> any()

Generate code from a JSON file with specified output type. Reads JSON content then passes to Rust compiler. -spec generate_from_file(string(), string()) -> {ok,binary()} | {error,term()} ===================================================================

get_rust_generator_path/0

get_rust_generator_path() -> any()

Get the Rust Aleph compiler executable path. Checks process dictionary, then environment variable ALEPHC_BIN, else returns the default path. -spec get_rust_generator_path() -> string() ===================================================================

set_rust_generator_path/1

set_rust_generator_path(Path) -> any()

Set the file path of the Rust Aleph compiler executable. Stored in the process dictionary for current process. -spec set_rust_generator_path(string()) -> ok ===================================================================


Generated by EDoc