Skip to content

Latest commit

 

History

History
29 lines (20 loc) · 702 Bytes

File metadata and controls

29 lines (20 loc) · 702 Bytes

string-generator

String generator for Context-Free Grammars

About the program

Given a context-free grammar, get strings generated by that grammar. The fast mode option generates one of the simplest string possible and the detailed mode gives you options to generate the string wanted.

To run the program, go to the terminal and type:

$ python ./main.py “grammar.txt”

You should specify the grammar file's path if the grammar code isn’t in the string-generator directory.

The context-free grammar file program must be in the following format as the “test.txt” example in the main directory:

variaveis:S,A
inicial:S
terminais:0,1

producoes
S: 0A1
A: 0
A: 1
A: 0A1