R-WHILE Playground
R-WHILE code
(* A non-terminating example *) read X0; FORWARD ^= (nil.nil); (* A flag for direction *) from =? X nil do if =? S nil then (* X is set to true (nil.nil) in both directions *) X ^= (nil.nil) fi =? S nil loop if =? FORWARD nil then (* nil is pused onto S in both directions *) cons nil S <= S else S <= cons nil S fi =? FORWARD nil until =? X nil; write X0
Input data
('1.('2.('3.nil)))
Options
Inversion
Program2data
Expand macros
Execute
Sample programs and data
reverse
swap
translation from a tree to its preorder and inorder traversal (piorder)
self-interpretation of an identity function
self-interpretation of reverse
self-interpretation of piorder
self-interpretation of self-interpretation of reverse (This will probably time out in this playground.)
Infinite loop (in *both* directions)
Enumeration of trees