local operation_stack = { ... } local fact_pool = { ... } local operations = { ... } while #ops > 0 do local op = pop(operation_stack) if operations[op] then operations[op](operation_stack, fact_pool) else if not fact_pool[op] then fact_pool[op] = 0 end fact_pool[op] = fact_pool[op] + 1 end end