def semantic_checks(tree): semdata = SemData() semdata.variable_def = [] semdata.parameters = {} semdata.funcs = {} visit_tree(tree, before_fun, after_fun, semdata) return semdata
def semantic_checks(tree, semdata): '''Run semantic checks Note: Some semantic checks are run during interpretation, since e.g. variable value expressions need to be evaluated before the values can be checked. ''' # "Data collection phase": visit_tree(tree, create_symbol_table, None, semdata)
def semantic_checks(tree, semdata): '''run all semantic checks''' # Initialize 'oper +' level count to 0 semdata.plus_level = 0 # Gather information visit_tree(tree, add_vars, None, semdata) visit_tree(tree, check_vars, None, semdata) # Check stupid things visit_tree(tree, check_literals, None, semdata) visit_tree(tree, check_plus_level_before, check_plus_level_after, semdata)
def semantic_checks(tree, semdata): semdata.plus_level = 0 visit_tree(tree, add_vars, None, semdata)
def semantic_checks(tree, semdata): '''run all semantic checks''' semdata.stack = [] semdata.stack_size = 0 # Initially stack is empty semdata.old_stack_sizes = [] # Initially no old stacks visit_tree(tree, check_everything, None, semdata)