Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
pl/0 to retro compiler
Retro 11.5
ok ( ---------------------------------- )
ok ( runtime library )
ok ( ---------------------------------- )
ok : odd? mod 2 1 = ;
ok ( ---------------------------------- )
ok ( generated code )
ok ( ---------------------------------- )
ok variables| i |
ok variables| n |
ok : square i @ n ! n @ n @ * putn cr ;
ok 0
ok i
ok !
ok [ i @ 10 < ]
ok [ [ i @ 1 + i ! square i @ 10 < ] while ]
ok ifTrue 1
4
9
16
25
36
49
64
81
100
ok bye
# no parametrs in this language, so we'll use a global for now
var i;
procedure square;
var n;
begin
n := i;
! ( n * n )
end;
begin
i := 0 ;
while i < 10 do begin
i := i + 1 ;
call square
end
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.