| Crates.io | elixirgen |
| lib.rs | elixirgen |
| version | 0.1.0 |
| created_at | 2025-07-27 05:33:11.681088+00 |
| updated_at | 2025-07-27 05:33:11.681088+00 |
| description | Elixir generator. |
| homepage | |
| repository | https://github.com/aleph-lang/elixirgen |
| max_upload_size | |
| id | 1769733 |
| size | 17,514 |
aleph-syntax-treeThis crate provides a code generator that transforms an abstract syntax tree (AST) from the aleph-syntax-tree crate into Elixir source code.
AlephTree expressions into idiomatic Elixir codeInt, Float, Bool, String, BytesArray, TupleIf, While, Match, Stmts, Let, LetRecApp, Return, Not, And, OrGet, Put, Remove, LengthComment, Assert, Import, etc.Make sure you have the aleph-syntax-tree crate available in your workspace.
use aleph_syntax_tree::syntax::AlephTree;
use your_crate::generate;
fn main() {
let ast = AlephTree::Let {
var: "x".into(),
is_pointer: false,
value: Box::new(AlephTree::Int { value: "42".into() }),
expr: Box::new(AlephTree::Return {
value: Box::new(AlephTree::Var { var: "x".into(), is_pointer: false }),
}),
};
let elixir_code = generate(ast);
println!("{}", elixir_code);
}
x = 42
x
pub fn generate(ast: AlephTree) -> String
Returns the Elixir code as a String.
Complex and class-related nodes are currently ignored or return empty strings.
COBOL-specific constructs are not supported in Elixir output.