pythongen 0.1.7

Python generator.
Documentation

pythongen

Generates Python source code from an AlephTree.

Installation

[dependencies]
pythongen = "0.1"

Usage

let code = pythongen::generate(ast);

Example

let ast = AlephTree::If {
    condition: Box::new(AlephTree::Bool { value: "true".into() }),
    then: Box::new(AlephTree::Int { value: "1".into() }),
    els: Box::new(AlephTree::Int { value: "0".into() }),
};
let code = pythongen::generate(ast);
// produces:
// if(true):
//     1
// else:
//     0

Supported constructs

Literals, arithmetic, boolean logic, if/else, while, let, match, arrays, tuples, functions (LetRec, App), return, import, assert.

Related