khepri-parse

2.8.1 • Public • Published

Khepri-parse

Parser and lexer for the Khepri programming language.

A library of Bennu parsers.

Usage

The main high level library interface is the lex and parse functions:

with
    import 'khepri-parse::lex::lexer' {lex},
    import 'khepri-parse::parse::parser' {parseStream}
{
    // `lex` takes a character array and produces a token Nu stream.
    // `parseStream` takes a lazy stream of tokens and outputs an AST.
    "\x -> x;"
        |> lex
        |> parseStream;
}

Individual Bennu parses may also be consumed:

with
    import 'khepri-parse::lex::number_lexer' {numericLiteral},
    import 'bennu::parse' {many run}
{
    var program := many numericLiteral;
    run(program, "1 2e3 3.03");
}

/khepri-parse/

    Package Sidebar

    Install

    npm i khepri-parse

    Weekly Downloads

    1

    Version

    2.8.1

    License

    MIT

    Last publish

    Collaborators

    • mattbierner