Prequel
primitive recursive driven programming
(This example requires web workers.)
Enter two non-negative integer numbers.
(Note that the Ackermann function grows very rapidly, even for small inputs.)
A(, ) = ...
←0
←0
←0
← calls
← instructions
← memory (max use: 0)
IF ackermann IS UNDEFINEDackermann = [ACKERMANN.INPUT]ENDIFm_n = ackermann.POPIF m_n[0] == 0IF ackermann.LENGTH == 0ACKERMANN.RETURN(m_n[1]+1)ENDIFprev_m_n = ackermann.POPprev_m_n.PUSH m_n[1]+1ackermann.PUSH prev_m_nELIF m_n[1] == 0m_n[0] -= 1m_n[1] = 1ackermann.PUSH m_nELSEackermann.PUSH [m_n[0]-1]m_n[1] -= 1ackermann.PUSH m_nENDIF
ACKERMANN.INPUTThe list of values written in the editable text input.-> e.g. [3, 2]CALL.ARGSHolds the list of arguments passed with CALL.-> [arg1, ..., argN]
ACKERMANN.RETURN(result)End computation and show the calculated value.-> result: calculated integer valueCALL(&retvar1, ..., &retvarM, @modname, arg1, ..., argN)Start executing module modname, copying N arguments and expecting M return values.-> retvar: name of variable to hold the corresponding return value retval-> modname: name of module to start executing-> arg: value to be copied to the list CALL.ARGSAlternative syntax: retvar1, ..., retvarM = CALL(@modname, arg1, ..., argN)Note that recursive module calls are not allowed.RETURN(retval1, ..., retvalM)Return M values from the current module.Resume execution at the next instruction of the corresponding CALL.-> retval: value to be copied to the corresponding variable retvar