Maintainer's Corner

Readme for madlang-2.4.2.0

Madlang DSL for generating random text

This is the Madlang DSL for generating text. You specify a template, and Madlang
will create randomized text from the template.

Madlang is an interpreted language, written in Haskell. It runs from the command line, but also provides a Haskell library that can be integrated into other projects, compiled to a web app, or used as an EDSL.

Syntax

There are two keywords in madlang you'll use most: :define and :return. :return is the main string we'll be spitting back; there can be only one per file. :define on the other hand can be used to make functions. These functions are combinations of templates, organizing pairs of weights and strings.

There is a Shakespearean insult generator demo available in
demo/shakespeare.mad

Installation

Releases

Nix

If you're on linux or mac, you can get up-to-date binaries via nix.

Download nix with

curl https://nixos.org/nix/install | sh

From there, nix-env -i madlang will install the proper executables.

Stack

Download stack with

curl -sSL http://haskellstack.org | sh

Then run stack install madlang --resolver nightly and you'll get the madlang executable installed on your path. This may take a bit of time, as it will build all dependencies of madlang first.

Use

To use it, try

$ madlang run demo/shakespeare.mad

You can do madlang --help if you want a couple other options for debugging.

Using the Haskell library

One function you might want to use is runFile; it reads a file and generates randomized text: