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),
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):
],
)
-NormalVariableAssignmentStatement = collections.namedtuple(
- 'NormalVariableAssignmentStatement',
+NormalVariableInitializationStatement = collections.namedtuple(
+ 'NormalVariableInitializationStatement',
[
'variable',
'expression',
prestatements.append(s)
variable = '${}'.format(counter)
- prestatements.append(NormalVariableAssignmentStatement(
+ prestatements.append(NormalVariableInitializationStatement(
variable=variable,
expression=normalized_argument,
))
counter += 1
root_prestatements = (
- NormalVariableAssignmentStatement(
+ NormalVariableInitializationStatement(
variable=left_variable,
expression=left_expression,
),
- NormalVariableAssignmentStatement(
+ NormalVariableInitializationStatement(
variable=right_variable,
expression=right_expression,
),
counter += 1
root_prestatements = (
- NormalVariableAssignmentStatement(
+ NormalVariableInitializationStatement(
variable=left_variable,
expression=left_expression,
),
- NormalVariableAssignmentStatement(
+ NormalVariableInitializationStatement(
variable=right_variable,
expression=right_expression,
),
],
)
-CVariableAssignmentStatement = collections.namedtuple(
- 'CVariableAssignmentStatement',
+CVariableInitializationStatement = collections.namedtuple(
+ 'CVariableInitializationStatement',
[
'variable',
'expression',
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),
)
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)