bisonpre: Commentary

This commit is contained in:
Wilson Snyder 2022-11-27 06:17:44 -05:00
parent d8071819fc
commit fa4270b551

View File

@ -17,20 +17,28 @@ def process():
bison_version_check()
supports_report = Bison_Version >= 2.3
supports_counter_examples = Bison_Version >= 3.8
clean_input(Args.input, tmp_prefix() + ".y")
# Run bison
command = (
Args.yacc + (" -t" if Args.debug else "") +
(" -d" if Args.definitions else "") +
(" -k" if Args.token_table else "") + (" -v" if Args.verbose else "") +
(" --report=itemset --report=lookahead" if
(Args.verbose and supports_report) else "")
Args.yacc #
+ (" -t" if Args.debug else "") #
+ (" -d" if Args.definitions else "") #
+ (" -k" if Args.token_table else "") #
+ (" -v" if Args.verbose else "") #
+ (" --report=itemset --report=lookahead" if
(Args.verbose and supports_report) else "")
# Useful but slow:
# (" -Wcounterexamples" if
# (Args.verbose and supports_counter_examples) else "")
#
# -p required for GLR parsers; they write to -p basename, not -o
+ ((" -p " + Args.name_prefix) if Args.name_prefix else "") + " -b " +
tmp_prefix() + " -o " + tmp_prefix() + ".c" + " " + tmp_prefix() +
".y")
tmp_prefix() #
+ " -o " + tmp_prefix() + ".c" #
+ " " + tmp_prefix() + ".y")
print(" " + command)
status = subprocess.call(command, shell=True)