def transform_integer_literal_expression(accumulators, expression):
return CIntegerLiteral(value=expression.value)
-def transform_parenthesized_expression(accumulators, expression):
- # Parentheses can be removed because everything in the C output is explicitly parenthesized
- return transform_expression(accumulators, expression.internal)
-
def transform_negation_expression(accumulators, expression):
return CNegationExpression(
value=transform_expression(accumulators, expression.internal_expression),
parsing.FurInfixExpression: transform_infix_expression,
parsing.FurIntegerLiteralExpression: transform_integer_literal_expression,
parsing.FurNegationExpression: transform_negation_expression,
- parsing.FurParenthesizedExpression: transform_parenthesized_expression,
parsing.FurStringLiteralExpression: transform_string_literal,
parsing.FurSymbolExpression: transform_symbol_expression,
normalization.NormalFunctionCallExpression: transform_function_call_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.builtin_set.add(function_call.function.value)
+ if isinstance(function_call.function, parsing.FurSymbolExpression):
+ # TODO Move this check to transformation of symbol expressions so we can have builtins that aren't functions
+ if function_call.function.value in BUILTINS.keys():
+ # TODO Check that the builtin is actually callable
+ accumulators.builtin_set.add(function_call.function.value)
# TODO Use the symbol from SYMBOL LIST
return CFunctionCallExpression(
- name=function_call.function.value,
+ name=transform_expression(accumulators, function_call.function),
argument_count=function_call.argument_count,
argument_items=transform_expression(accumulators, function_call.argument_items),
)