leo/compiler/wasm
2022-02-22 15:12:52 -08:00
..
src restructure compiler and delete unused code 2022-02-22 15:12:52 -08:00
tests restructure compiler and delete unused code 2022-02-22 15:12:52 -08:00
.gitignore restructure compiler and delete unused code 2022-02-22 15:12:52 -08:00
Cargo.toml restructure compiler and delete unused code 2022-02-22 15:12:52 -08:00
README.md restructure compiler and delete unused code 2022-02-22 15:12:52 -08:00

Leo WASM

Authors License

This directory contains WASM bindings for the Leo compiler.

Limitations

Currently, WASM target of the compiler supports parsing and canonicalization stages.

API

This is a list of the supported methods and their signatures.

leo.parse

Method takes in a Leo program as string and returns JSON string with the resulting AST or throws a LeoError.

export interface LeoError {
    text: string,    // Full error text (including span)
    code: string,    // Leo error identifier (e.g. "EPAR0370005")
    exitCode: number // Exit code for an error (e.g. 370005)
}

/**
 * @param {String} program Leo program text to parse and produce AST
 * @return {String} Resulting AST as a JSON string.
 * @throws {LeoError} When program contains invalid Leo code.
 */
export function parse(program: string): string;