variable assignment renamed to variable initialization for accuracy
authorDavid Kerkeslager <kerkeslager@gmail.com>
Tue, 8 Aug 2017 16:04:08 +0000 (12:04 -0400)
committerDavid Kerkeslager <kerkeslager@gmail.com>
Tue, 8 Aug 2017 16:04:08 +0000 (12:04 -0400)
generation.py
normalization.py
transformation.py

index 92d07be..4b0ad7e 100644 (file)
@@ -81,7 +81,7 @@ def generate_symbol_assignment_statement(c_assignment_statement):
         generate_expression(c_assignment_statement.expression),
     )
 
-def generate_variable_assignment_statement(statement):
+def generate_variable_initialization_statement(statement):
     return 'Object {} = {};'.format(
         statement.variable,
         generate_expression(statement.expression),
@@ -91,7 +91,7 @@ def generate_statement(statement):
     return {
         transformation.CSymbolAssignmentStatement: generate_symbol_assignment_statement,
         transformation.CExpressionStatement: generate_expression_statement,
-        transformation.CVariableAssignmentStatement: generate_variable_assignment_statement,
+        transformation.CVariableInitializationStatement: generate_variable_initialization_statement,
     }[type(statement)](statement)
 
 def generate(program):
index 0d967d7..94d3a7c 100644 (file)
@@ -27,8 +27,8 @@ NormalFunctionCallExpression = collections.namedtuple(
     ],
 )
 
-NormalVariableAssignmentStatement = collections.namedtuple(
-    'NormalVariableAssignmentStatement',
+NormalVariableInitializationStatement = collections.namedtuple(
+    'NormalVariableInitializationStatement',
     [
         'variable',
         'expression',
@@ -65,7 +65,7 @@ def normalize_function_call_expression(counter, expression):
             prestatements.append(s)
 
         variable = '${}'.format(counter)
-        prestatements.append(NormalVariableAssignmentStatement(
+        prestatements.append(NormalVariableInitializationStatement(
             variable=variable,
             expression=normalized_argument,
         ))
@@ -93,11 +93,11 @@ def normalize_basic_infix_operation(counter, expression):
     counter += 1
 
     root_prestatements = (
-        NormalVariableAssignmentStatement(
+        NormalVariableInitializationStatement(
             variable=left_variable,
             expression=left_expression,
         ),
-        NormalVariableAssignmentStatement(
+        NormalVariableInitializationStatement(
             variable=right_variable,
             expression=right_expression,
         ),
@@ -130,11 +130,11 @@ def normalize_comparison_expression(counter, expression):
     counter += 1
 
     root_prestatements = (
-        NormalVariableAssignmentStatement(
+        NormalVariableInitializationStatement(
             variable=left_variable,
             expression=left_expression,
         ),
-        NormalVariableAssignmentStatement(
+        NormalVariableInitializationStatement(
             variable=right_variable,
             expression=right_expression,
         ),
index b6d21c8..2d729fa 100644 (file)
@@ -73,8 +73,8 @@ CSymbolAssignmentStatement = collections.namedtuple(
     ],
 )
 
-CVariableAssignmentStatement = collections.namedtuple(
-    'CVariableAssignmentStatement',
+CVariableInitializationStatement = collections.namedtuple(
+    'CVariableInitializationStatement',
     [
         'variable',
         'expression',
@@ -264,8 +264,8 @@ def transform_expression_statement(accumulators, statement):
         expression=expression,
     )
 
-def transform_variable_assignment_statement(accumulators, statement):
-    return CVariableAssignmentStatement(
+def transform_variable_initialization_statement(accumulators, statement):
+    return CVariableInitializationStatement(
         variable=statement.variable,
         expression=transform_expression(accumulators, statement.expression),
     )
@@ -274,7 +274,7 @@ def transform_statement(accumulators, statement):
     return {
         parsing.FurAssignmentStatement: transform_symbol_assignment_statement,
         parsing.FurExpressionStatement: transform_expression_statement,
-        normalization.NormalVariableAssignmentStatement: transform_variable_assignment_statement,
+        normalization.NormalVariableInitializationStatement: transform_variable_initialization_statement,
         normalization.NormalExpressionStatement: transform_expression_statement,
     }[type(statement)](accumulators, statement)