Skip to content

Commit

Permalink
feat: add --theories option to command line
Browse files Browse the repository at this point in the history
  • Loading branch information
nicdard committed May 24, 2022
1 parent 960d5dd commit d0bec66
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ def parse_args():
default='fusion_functions', help='name of the output file')
parser.add_argument('--dot', '-d', action='store_true',
help='emit formulas and inverses also to dot files')
parser.add_argument('--theories', choices=['bool', 'int', 'real', 'string'], nargs='+',
default=[], help='specify the theories to be used during generation')
return parser.parse_args()


Expand All @@ -54,6 +56,12 @@ def main(args):
file_name += '.txt'

operator_types = gen_configuration.get_theories()
if args.theories:
operator_types = [gen_configuration.option_to_operator_type[option]
for option in args.theories]
if args.verbose:
print(f"Using theories: {operator_types}")

infix_printer = InfixPrinterVisitor()
trees = []
for i in range(args.num_functions):
Expand Down
8 changes: 8 additions & 0 deletions src/gen/gen_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@
"StringOperator": "StringEquality",
}

# A map from command line options to the internal representation.
option_to_operator_type: Dict[str, str] = {
"bool": "BooleanOperator",
"int": "IntegerOperator",
"real": "RealOperator",
"string": "StringOperator",
}


def get_theories():
return list(theory_declarations.keys())
Expand Down

0 comments on commit d0bec66

Please sign in to comment.