Recommended Posts

I need to make a little script engineish program. Basically, I need to parse and handle multiple decision types ( if, for, while, etc ). These decisions can be nested within one another. In thinking about how to implement it, I've considered that I could call a function for each decision type. Three nested if's, therefore, would call the "if" function 3 times, recursively. Is there a better way to do this? How substantial will the hits from the additional call stack be, doing it recursively like this?

Share this post

Link to post

Share on other sites

How deeply nested ifs fors etc are you expecting?20 would mean a monster-horror-killer structure, and that's only 20, it's negligible.You have to consider storage/performance in flood-fill like situations (where there are branching, and the algorithm can fill thousands or millions of elements)