Coder Social home page Coder Social logo

alimsahy / rant Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rant-lang/rant

0.0 1.0 0.0 2.38 MB

Rant - High-level procedural templating language

License: GNU Affero General Public License v3.0

Rust 61.70% HTML 38.05% Handlebars 0.25%

rant's Introduction

Rant Logo

Crates.io Docs.rs Discord

Rant is a high-level procedural templating language with a diverse toolset for easily creating dynamic code templates, game dialogue, stories, name generators, test data, and much more.


Prerelease notice

This project is in alpha. This means that the API is unstable, functionality may be broken/missing, and everything is subject to change.

Please do try it out and give feedback; however, do not use in production environments until a stable version is released.

Features may appear/disappear at any time for any reason. Assume that every alpha release will have breaking changes.

Introducing: Rant 4

Rant 4 is a complete redesign and reimplementation of the Rant language, written in Rust. It's designed with usability in mind for everyone-- programmers, writers, and everyone in-between!

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

Why Rant?

๐Ÿงฐ Painless API
Rant's API is designed to be as straightforward as possible. Integrating Rant into your project only takes a few lines of code.

๐Ÿ’ป Cross-Platform
Write once, run anywhere-- Rant code is fully portable across all supported platforms.

๐ŸŽฒ Built with โ™ฅ for RNG
Enjoy a wide array of built-in utilities for generating random numbers, strings, booleans, lists, list subsets, and much more. The internal RNG can be seeded before execution to produce deterministic outputs.

๐Ÿ”ฑ Advanced Branching
Fine-tune branching behavior with a multitude of configuration options and branch selection modes for iterative, random, and weighted selection.

๐ŸŽจ Dynamic Variable System
Inspired by other popular scripting languages, Rant's dynamic variable system ergonomically supports common primitives, collection types, closures, and more.

๐Ÿ–จ Print Semantics
Rant is all about "printing": each lexical scope has an output to add values ("print") to, which then prints itself to the parent output, and so on. This lets you easily build strings and collections from multiple parts with minimal code.

๐Ÿงฌ Delightful Combinatorics
Perform nested mappings, filters, zips, combinations, and more with Rant's intuitive piping syntax.

๐ŸŽ› Automatic Formatting
Passively format text output with automatic capitalization, whitespace normalization, and number formatting.

๐Ÿงฉ Modules
Create libraries of Rant functions and share them between your programs using Rant's simple module system.

๐Ÿ“š Rant Standard Library
A comprehensive standard library provides the tools needed to rapidly iterate on your ideas.

Getting started

CLI

Rant's CLI can run Rant code from files or the command line. Install it from Cargo with:

$ cargo install rant --version 4.0.0-alpha.22 --features cli

Then run it:

$ 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(())
}

This repository contains a directory of example programs written in Rant for you to learn from. Check them out!

Documentation

The latest reference documentation can be found at 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.

The changelog is updated constantly throughout the development process, providing a complete summary of upcoming changes at a glance even before the next release.

MSRV

The minimum supported Rust version is 1.53.0.

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.