def load_grammar(self, path):
if not os.path.exists(path):<EOL><INDENT>raise Exception("<STR_LIT>".format(path))<EOL><DEDENT>grammar_path = os.path.dirname(path)<EOL>if grammar_path not in sys.path:<EOL><INDENT>sys.path.append(grammar_path)<EOL><DEDENT>with open(path, "<STR_LIT:r>") as f:<EOL><INDENT>data = f.read()<EOL><DEDENT>code = compile(data, path, "<STR_LIT>")<EOL>locals_ = {"<STR_LIT>": self, "<STR_LIT>": path}<EOL>exec(code, locals_)<EOL>if "<STR_LIT>" in locals_:<EOL><INDENT>cat_group = os.path.basename(path).replace("<STR_LIT>", "<STR_LIT>")<EOL>self.set_cat_group_top_level_cat(cat_group, locals_["<STR_LIT>"])<EOL><DEDENT>
Load a grammar file (python file containing grammar definitions) by
        file path. When loaded, the global variable ``GRAMFUZZER`` will be set
        within the module. This is not always needed, but can be useful.

        :param str path: The path to the grammar file