leo/wasm
2021-09-25 12:13:59 +03:00
..
src adds README, extends error object 2021-09-25 12:13:59 +03:00
tests adds README, extends error object 2021-09-25 12:13:59 +03:00
.gitignore staging for wasm 2021-09-16 17:20:37 +03:00
Cargo.toml adds README, extends error object 2021-09-25 12:13:59 +03:00
README.md adds README, extends error object 2021-09-25 12:13:59 +03: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;