Skip to content

The famous random sentence generator.

License

Notifications You must be signed in to change notification settings

evilmastermind/Polygen

 
 

Repository files navigation

Polygen

https://github.com/alvisespano/Polygen

Polygen — a first effort towards satyre in computer science.


Table of Contents


SUBMODULE NOTE — This project contains a submodule (grammars folder); don't forget to initialize it (once) after cloning:

git submodule update --init --recursive

Also, to keep the submodule always up to date with the latest changes, don't forget to use:

git submodule update 

For more information on Git submodules, see:

1.0 Prelude

Polygen is a command line program for generating random sentences according to a grammar definition, that is following custom syntactical and lexical rules. It takes a text file as source program defining a grammar by means of BNF-like rules and executes it, eventually showing the result.

Here a source program is a grammar definition, the execution consists in the exploration of such grammar by selecting a random path and the result is the sentence built on the way.

PolyGUIScreenshot

1.1 Package

1.1.1 Requirements

Polygen is fairly slim and does not need that powerful computer in order to work.

From a theoretical point of view, there could be unlucky cases making the program loop for a sensible amount of time over a certain recursive production; in the real world, though, it will never happen.

Everything you need is a shell or command line interpreter (such as Bash or Csh under UNIX/Linux or the DOS Command Prompt under Windows) and, only in case you wish to write/view a grammar source file, a plain text editor/viewer.

1.1.2 Supported platforms

Polygen packages come in a variety of flavours, some providing different executable files in a platform-dependent way. Be sure the one you downloaded suits your machine and operating system.

A package containing the full source code exists as well and is intended for either people who just wish to know how Polygen works or users whose platform is not directly supported by a package containing an executable file for their machine. The latter will be able to compile the program by themselves following the instructions in the README file located in the source directory.

1.1.3 Installation

Polygen needs no installation: it just consists of an executable file and a bunch of grammar sources.

Leave it as is in an own directory and 'cd' there when you want to use it.

Refer to platform-dependant README file for additional hints.

1.1.3.1 Windows Precompiled Binaries

In the root of this project you'll find a Zip archive containing the precompiled binaries of Polygen and PolyGUI, along with the correct version of cygwin1.dll required for running Polygen under Windows 10:

Just unpack its contents and you're ready to use it.

1.2 Usage

The executable file must be launched from a shell or command line interpreter, as stated in section 1.1.2. It takes a set of arguments and prints to standard output, which is the shell terminal itself by default. For the formal synopsis run the executable with no arguments.

1.2.1 Defining grammars

For a detailed guide on Polygen Meta Language (PML), the grammar definition language interpreted by Polygen, see the documentation included in the /docs/ folder:

1.2.2 Suggestions

  • Remember to provide an "I" non-terminal symbol in your own grammar files for the -info option.
  • Try to avoid as many warnings as possible when developing your own grammar sources: your definitions will be more robust and won't lead to unexpected outputs.

About

The famous random sentence generator.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • OCaml 95.0%
  • HTML 4.9%
  • Shell 0.1%