Skip to content
/ CFG Public

Generator for phrases based on context-free grammars

License

Notifications You must be signed in to change notification settings

igor37/CFG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CFG

CFG is a generator for phrases based on context-free grammars. Easy to use with calls from the command line.

Getting started

Prerequisites

For compiling the project the Rust compiler and Cargo are required.
See https://www.rust-lang.org/en-US/install.html for instructions.

Running the example

After cloning/downloading the repository, simply switch into CFG's directory and compile with:

cargo build --release

This generates an executable file in the target/release subdirectory.
The program has to be run with a file containing the rules of the context-free grammar. The repository already includes an example file for testing and getting familiar with the syntax. If you want to try it out right after compiling, execute the following command:

target/release/cfg src/example_cfg -s

# General syntax:
cfg <file path> [-s]

With the optional -s flag all phrases are output with an empty line inbetween as spacing. If everything went right the output using the example file should look a bit like this:

...
A sleepy white turtle dances around the sleepy raccoon

The sleepy grey fox jumps around a crazy turtle

A sleepy black raccoon jumps around the sleepy panda

A quick grey dog jumps around the sleepy raccoon

The sleepy white raccoon jumps over a lazy fox

License

This project is licensed under the MIT License - see the LICENSE.md file for details

About

Generator for phrases based on context-free grammars

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages