An xml-based language for creating random generators.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
tests
.gitignore
README.md
generator.py

README.md

generator

An xml-based language for creating random generators.

Introduction

usage: generator.py [-h] script

Evaluate a random generation script.

positional arguments:
  script      the script to evaluate

optional arguments:
  -h, --help  show this help message and exit

Generator is fast, open-ended, and easy to use. Anyone that can write XML can use Generator to create random generators for any concept that can be expressed in Backus-Naur Form. In essence, this allows the user to instantiate a sample of the language space with a few lines of code. Possible uses include test case and content generation.

The language specification is under development. Generator.py is the Python prototype of the Generator interpreter.

The generator Language

Generator is written in XML. Since this is for random generators, Hello World becomes Hello Worlds:

<generator>
  <!-- Comments are standard xml comments -->
  <!-- Template is the 'main' entry point of a generator -->
  <!-- Select tags are function calls for Set tags -->
  <template>Hello {@worlds}!</template>

  <!-- Tables are a convenient way to choose a random text element -->
  <table name="worlds">
      - Mercury
      - Venus
      - Earth
      - Mars
      - Jupiter
      - Saturn
      - Neptune
      - Uranus
  </table>
</generator>
$ generator.py ./examples/hello_worlds.xml
Hello Neptune!

For examples in the generator language, review the tests cases found in

/tests/test_cases/

Running Tests

You can run tests with Nose. To do so, go to the project level directory (the one with the README) and do

nosetests