Skip to content

Files

Latest commit

 

History

History
37 lines (29 loc) · 834 Bytes

README.md

File metadata and controls

37 lines (29 loc) · 834 Bytes

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");
}