Quality of Life Improvements #7

Merged
aCompetentBean merged 1 commit from ayrton/qol into main 2023-11-25 14:16:30 -07:00
4 changed files with 9 additions and 8 deletions

View file

@ -142,17 +142,17 @@ class AstGenerator:
self.current_ast_element.append(element)
self.current_ast_element = element
if block_type in [GAZ_PROCEDURE_TAG, GAZ_FUNCTION_TAG]:
self.generate_statements()
else:
self.generate_statements(include='declaration')
self.generate_statements(exclude='declaration')
# Generate the loop condition increment if we are in a loop
if block_type == GAZ_LOOP_TAG:
self.generate_loop_condition_check(loop_var)
self.generate_loop_condition_increment(loop_var)
if block_type not in [GAZ_PROCEDURE_TAG, GAZ_FUNCTION_TAG]:
self.generate_statements()
else:
self.generate_statements(include='declaration')
self.generate_statements(exclude='declaration')
if return_stmt:
self.generate_return(return_type=return_type, return_value=return_value)
if self.settings['generation-options']['generate-dead-code']:

View file

@ -90,7 +90,7 @@ misc-weights:
type-qualifier-weights:
const: 10
var: 60
truthiness: 0.9 # Probability of conditionals being true
truthiness: 0.99 # Probability of conditionals being true
block-termination-probability: 0.2 # probability for a block to terminate

View file

@ -35,7 +35,6 @@ class GazpreaFuzzer:
def fuzz(self):
self.generator.generate_ast()
self.write_ast() # FIXME sometimes this is none
self.gaz_source_gen = GazUnparser(self.generator.ast, True)
try:
@ -56,6 +55,7 @@ class GazpreaFuzzer:
pass
# exec(str(self.ground_truth))
# exec(self.ground_truth, globals(), locals()) # FIXME the exec doesn't actually execute for some reason...
self.write_ast() # FIXME sometimes this is none
self.out = buf.getvalue()

View file

@ -129,6 +129,7 @@ class Fuzzer():
with open("{}/{}_{}.out".format(fuzzer_outputs, self.file_name, i), 'r') as y:
out = y.read()
if out == "":
print("Empty output, skipping", file=sys.stderr)
os.system("rm -f {}/{}_{}.py".format(fuzzer_ground_truth, self.file_name, i))
os.system("rm -f {}/{}_{}.out".format(fuzzer_outputs, self.file_name, i))
if i - 1 >= min_i: