How to parse function calls in nested loops?

Hi all. This question is a language with loops ( loops are implemented only for the repetition of blocks, no counters ), inside loops are called functions

Example:

for 2:___2
{
 FRAME7 0...100
 for 3:___7
{
 FRAME8 0...100
 FRAME9 0...100
}
}


To simplify I decided to mark the cycle by a unique number, after the __ is the number of iterations required

How to parse this code in the following chain?

FRAME7 0...100

 FRAME8 0...100
 FRAME9 0...100
 FRAME8 0...100
 FRAME9 0...100
 FRAME8 0...100
 FRAME9 0...100
 FRAME8 0...100
 FRAME9 0...100
 FRAME8 0...100
 FRAME9 0...100
 FRAME8 0...100
 FRAME9 0...100
 FRAME8 0...100
 FRAME9 0...100

FRAME7 0...100

 FRAME8 0...100
 FRAME9 0...100
 FRAME8 0...100
 FRAME9 0...100
 FRAME8 0...100
 FRAME9 0...100
 FRAME8 0...100
 FRAME9 0...100
 FRAME8 0...100
 FRAME9 0...100
 FRAME8 0...100
 FRAME9 0...100
 FRAME8 0...100
 FRAME9 0...100


Thank you

P. S. I Write in python. Is it possible to do it without splitting the code into tokens?
July 8th 19 at 11:38

Find more questions by tags PythonTranslators