Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including khepri-parse with all npm packages installed. Try it out:

var khepriParse = require("khepri-parse")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

khepri-parse v2.8.1

Khepri language lexer and parser

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

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free