local operation_stack = { ... } local fact_pool = { ... } local operations = { ... } while #ops > 0 do local op = pop(operation_stack) operations[op](operation_stack, fact_pool) end