Crate umbra_lang[][src]

Expand description

A simple macro-based language inspired by Rust and Python.

This crate can be used either directly as an interpreter binary or embedded in another program.

Parsing is still a little weird but just add parentheses! :^)

Direct Usage

To run the REPL simply use cargo run. To see examples of possible code constructs look at the scripts in test/. You can run scripts by providing the name as an argument as follows: cargo run -- scriptname. You can also run modules with cargo run -- modname. This is the same as running cargo run -- modname/main.um. One such module is test.

Embedded Usage

This crate can be added to your dependencies by adding the following to your project’s Cargo.toml:

[dependencies]
umbra_lang = "0.21.0"

To use the library, call the desired run*() functions (documented below). For example:

let env = Env::prelude();
let (vars, val) = run_path("script.um", &env, true);

Macros

Prints to the current Thread’s local error out.

Prints to the current Thread’s local output.

Structs

A collection of interpreter flags and script arguments.

The environment that scripts use to store and access variables.

Denotes a specific position within a script.

A reference to a TVal, locked via Mutex.

A collection of all data required for final script execution.

A Type-Value pair along with an attribute map.

The context for a running Thread. Can be joined from multiple threads.

A piece of the tokenized script.

Enums

The parsed representation of a script expression.

A function that is either called natively via Rust or run via an AST.

An error that occured during argument handling, parsing, script execution, or for control flow or other purposes.

Function arguments for various types of functions.

Easily differentiates Tokens.

A representation of a kind of Value. Most variants just represent the corresponding Value variants.

A representation of any valid value in a script.

Functions

Splits, tokenizes, parses, and constructs a Runnable from script. Generally not necessary to use directly.

Compiles the script then executes it in the given environment.

Start an interactive interpreter session (REPL) in the given environment.

Loads a script from path and runs it in the given environment.

Type Definitions

A pair of updated environment vars and the evaluated value.