From e0873511cc1425343bb70545571406b25b9cf5d9 Mon Sep 17 00:00:00 2001 From: David Kerkeslager Date: Mon, 7 Aug 2017 22:08:33 -0400 Subject: [PATCH] Slightly better naming --- generation.py | 2 +- transformation.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/generation.py b/generation.py index 4ac6948..fcfaee1 100644 --- a/generation.py +++ b/generation.py @@ -95,7 +95,7 @@ def generate_statement(statement): def generate(c_program): template = ENV.get_template('program.c') return template.render( - builtins=list(sorted(c_program.builtins)), + builtins=list(sorted(c_program.builtin_set)), statements=[generate_statement(statement) for statement in c_program.statements], standard_libraries=list(sorted(c_program.standard_libraries)), symbol_list=c_program.symbol_list, diff --git a/transformation.py b/transformation.py index d27a0c5..67fd73c 100644 --- a/transformation.py +++ b/transformation.py @@ -67,7 +67,7 @@ CAssignmentStatement = collections.namedtuple( CProgram = collections.namedtuple( 'CProgram', [ - 'builtins', + 'builtin_set', 'statements', 'standard_libraries', 'symbol_list', @@ -197,7 +197,7 @@ def transform_negation_expression(accumulators, negation_expression): def transform_function_call_expression(accumulators, function_call): if function_call.function.value in BUILTINS.keys(): # TODO Check that the builtin is actually callable - accumulators.builtins.add(function_call.function.value) + accumulators.builtin_set.add(function_call.function.value) return CFunctionCallExpression( name='builtin$' + function_call.function.value, @@ -219,14 +219,14 @@ def transform_statement(accumulators, statement): Accumulators = collections.namedtuple( 'Accumulators', [ - 'builtins', + 'builtin_set', 'symbol_list', ], ) def transform(program): accumulators = Accumulators( - builtins=set(), + builtin_set=set(), symbol_list = [], ) @@ -235,12 +235,12 @@ def transform(program): ] standard_libraries = set() - for builtin in accumulators.builtins: + for builtin in accumulators.builtin_set: for standard_library in BUILTINS[builtin]: standard_libraries.add(standard_library) return CProgram( - builtins=accumulators.builtins, + builtin_set=accumulators.builtin_set, statements=c_statements, standard_libraries=standard_libraries, symbol_list=accumulators.symbol_list, -- 2.20.1