Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    khepri-parsepublic

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

    install

    npm i khepri-parse

    Downloadsweekly downloads

    138

    version

    2.8.1

    license

    MIT

    repository

    githubgithub

    last publish

    collaborators

    • avatar