# Voxpop

Voxpop generates text from declarative grammars.

It is roughly a version of [Calyx]( ported to Elixir.

## Installation

If [available in Hex](, the package can be installed as:

  1. Add voxpop to your list of dependencies in `mix.exs`:

        def deps do
          [{:voxpop, "~> 0.0.1"}]

## Usage

The API is still currently in flux while I work some things out, but in the general
case, you do things like this:

iex> Voxpop.generate %Voxpop.Grammar.Definition{start: "Hello {greeting}!", rules: %{greeting: "world"}}
"Hello World"

Your rules can have multiple options which will be randomly chosen:

%Voxpop.Grammar.Definition{start: "Hello {group}!", rules: %{group: ["comrades", "folks", "friends"]}}

There is also a DSL, if you'd prefer to define your grammar as part of a module:

defmodule MyGrammar do
  use Voxpop.Grammar

  start "{greeting} {group}!"
  rule :greeting, "Hello"
  rule :group, "World"