X-Git-Url: https://code.kerkeslager.com/?p=fur;a=blobdiff_plain;f=generation.py;h=d855d07b3a5c6f4d384f5d032e096a9608fae9cf;hp=74a3fa52baa15f1654abe983f0d93f4c712d022c;hb=64ef22e135f7c790f0cd80956d8bdf7fa0268148;hpb=4d6f362ca35cd00803b1a79e03985301bcfbeea8 diff --git a/generation.py b/generation.py index 74a3fa5..d855d07 100644 --- a/generation.py +++ b/generation.py @@ -34,8 +34,9 @@ def generate_structure_literal_expression(expression): ) def generate_lambda_expression(expression): - return '(Object){{ CLOSURE, (Instance)(Closure){{ environment, user${}$implementation }} }}'.format( + return '(Object){{ CLOSURE, (Instance)(Closure){{ environment, user${}${}$implementation }} }}'.format( expression.name, + expression.index, ) def generate_list_construct_expression(expression): @@ -55,10 +56,10 @@ def generate_expression(expression): def generate_function_call(function_call): # This gets called twice, so we want to be sure it is efficient and without side effects - assert isinstance(function_call.function_expression, transformation.CVariableExpression) + assert isinstance(function_call.function_expression, transformation.CSymbolExpression) # TODO Check the type of the things being called - function_expression = generate_variable_expression(function_call.function_expression) + function_expression = generate_expression(function_call.function_expression) return '{}.instance.closure.call(environmentPool, {}.instance.closure.closed, {}, stack, {}, jump)'.format( function_expression, function_expression, @@ -165,6 +166,7 @@ def generate_function_definition(definition): template = ENV.get_template('function_definition.c') return template.render( name=definition.name, + index=definition.index, argument_name_list=definition.argument_name_list, statement_list=list(generate_statement(s) for s in definition.statement_list), )