Elixir Code Generator for aleph-syntax-tree
This crate provides a code generator that transforms an abstract syntax tree (AST) from the aleph-syntax-tree crate into Elixir source code.
Features
- Converts
AlephTreeexpressions into idiomatic Elixir code - Supports a wide range of constructs:
- Literals:
Int,Float,Bool,String,Bytes - Data structures:
Array,Tuple - Control flow:
If,While,Match,Stmts,Let,LetRec - Functional:
App,Return,Not,And,Or - Array manipulation:
Get,Put,Remove,Length - Miscellaneous:
Comment,Assert,Import, etc.
- Literals:
- Automatically handles indentation and formatting
- Skips unsupported nodes with clean fallbacks
Usage
Add to your project
Make sure you have the aleph-syntax-tree crate available in your workspace.
Example
use AlephTree;
use generate;
Output
x = 42
x
Function Signature
Returns the Elixir code as a String.
Limitations
- Complex and class-related nodes are currently ignored or return empty strings.
- COBOL-specific constructs are not supported in Elixir output.