rant 4.0.0-alpha.8

The Rant procedural generation language
Documentation

Crates.io Docs.rs Discord

Rant is a high-level language for templating and procedural generation. Easily create dynamic templates, dialogue, stories, names, test data, and much more.


WARNING:

This project is in alpha. Expect to see broken/missing features.

While I encourage you to try it out and give feedback, please do not use in production environments until a stable version is released.

Features may appear or disappear at any time for any reason. Assume that every alpha release will be breaking.


Introducing Rant 4

Rant 4 is a complete remake of the Rant language and runtime. It delivers a vastly improved user experience designed around the needs of everyone-- from writers and programmers, to anybody else!

Think of Rant as the opposite of Regex: just as a regular expression compares inputs to a pattern, Rant generates matching outputs from a pattern!

Consider this regex:

(Hey|Hi|Hello) world!

The Rant equivalent is nearly identical:

{Hey|Hi|Hello} world!

##
Possible outputs:
 * "Hey world!"
 * "Hi world!"
 * "Hello world!"
##

Features

  • Pain-free API: Rant's API is designed to be as straightforward as possible. Get started with just a few lines of code.
  • Dynamic variable system: Represent any kind of data using Rant's built-in primitive and collection types.
  • Branching: Diversify your output with a multitude of branch selection modes, both random and otherwise.
  • Automatic formatting: Passively format your output with automatic capitalization, whitespace normalization, and number formatting.
  • Rant Standard Library: Leverage Rant's comprehensive standard library to get more done with less code.
  • Modules: Create libraries of Rant functions to easily share between your programs.
  • Entanglement: Synchronize different parts of your programs using built-in RNG synchronization utilities.
  • Portability: Rant code is fully portable. Write once and run on any supported platform!

Getting started

CLI

Rant comes with a CLI tool that includes a REPL. You can install and run it with:

$ cargo install rant --version=4.0.0-alpha.8 --all-features
$ rant

Library

Add Rant to your Cargo.toml:

[dependencies]
rant = "*"

You can run a Rant program with just a few lines of code:

use rant::Rant;
use std::error::Error;

fn main() -> Result<(), Box<dyn Error>> {
  // Create a default Rant context
  let mut rant = Rant::new();

  // Compile a simple program
  let program = rant.compile_quiet(r#"
  [$greet:name] {
    {Hello|Hi|Hey} <name>!
  }
  [greet:world]
  "#)?;

  // Run the program and print the output
  let output = rant.run(&program)?;
  println!("{}", output);

  Ok(())
}

Documentation

The latest documentation can be found at the official docs.rant-lang.org.

Since Rant 4 is early in development, some documentation may be outdated/incomplete, but it is actively updated to ensure that it reflects current features with reasonable accuracy.

License

Rant is distributed under the GNU Affero General Public License v3. See LICENSE for more details.

An alternative, commercial license is planned for the future.