diff --git a/challs/context_free_grammar/README.md b/challs/context_free_grammar/README.md new file mode 100644 index 00000000..19565a7e --- /dev/null +++ b/challs/context_free_grammar/README.md @@ -0,0 +1,6 @@ +Intended solution + +1. Read folder structure as productions. +2. Folders are nonterminals, files are terminals. +3. Simplify and reduce. +4. Some parts are quickly guessable, others can be permuted from given letters and word lengths. \ No newline at end of file diff --git a/challs/context_free_grammar/chall/cfg.zip b/challs/context_free_grammar/chall/cfg.zip new file mode 100644 index 00000000..6786afe6 Binary files /dev/null and b/challs/context_free_grammar/chall/cfg.zip differ diff --git a/challs/context_free_grammar/solve.py b/challs/context_free_grammar/solve.py index 70591159..ee0e218d 100644 --- a/challs/context_free_grammar/solve.py +++ b/challs/context_free_grammar/solve.py @@ -339,8 +339,8 @@ def get_rules(path, outf): line = dir + " -> " + "|".join([x.replace(".txt", "") for x in os.listdir(os.path.join(path, dir))]) + "\n" f.write(line) -file = "chall/cfg.txt" -grammar = Grammar(file) +#file = "chall/cfg.txt" +#grammar = Grammar(file) #grammar.reduce_mappings() #grammar.add_useless_productions() #grammar.scramble_nonterminals()