leo/wasm
2022-01-17 16:30:08 -08:00
..
src clippy 2022-01-17 16:30:08 -08:00
tests remove console.log 2021-09-27 19:53:11 +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;