Home » 2021 » March » 21 » function stack implementation
12:03 PM
function stack implementation

function stack ...option

// function or subroutine call
inside curly baraces is internal interpreter code


myFunc()
{ fnStack[index] : fst = index }
...
label CONTINUE
..
.|.
.V.
...................
func myFunc()
....................
label HERE:
{ fst = fst - 1 }

// recursive call from inside //

if TRUE
..............
myFunc()
..............
{ fst = fst + 1 }
{ index = fst }
{ pos = fnStack[index] } -> return to label HERE
end if

.........
endFn
.........
{ fst = fst + 1 }
{ pc = fnStack[fst] } -> return to label CONTINUE
Views: 34 | Added by: Zlatko | Rating: 0.0/0
Total comments: 0
Name *:
Email *:
Code *: