This code is generated by this version of the pl/0 compiler:
code generated by running:
# if ply not installed:
cd ply-3.4 ; sudo python setup.py install ; cd ..
michal@proton:~/vrx$ ./retro --with recurse.rx | |
Retro 11.5 | |
ok ( ---------------------------------- ) | |
ok ( runtime library ) | |
ok ( ---------------------------------- ) | |
ok : odd? mod 2 1 = ; | |
ok ( ---------------------------------- ) | |
ok ( generated code ) | |
ok ( ---------------------------------- ) |
This code is generated by this version of the pl/0 compiler:
code generated by running:
# if ply not installed:
cd ply-3.4 ; sudo python setup.py install ; cd ..
# program to demonstrate recursion. | |
# prints a 4-digit binary number | |
const | |
digits = 4; | |
# no parametrs in this language, so we use globals | |
var | |
number, # the number to convert to binary | |
cursor; # the current digit position ( moves high to low ) |
; -- global configuration -------------------------------------- | |
SetTitleMatchMode 1 ; match at start of title. | |
; -- keyboard -------------------------------------------------- | |
#UseHook | |
!h::SendPlay,{Left} | |
!t::SendPlay,{Down} |
from operator import add,mul | |
class nda(list): | |
"""n-dimensional arrays""" | |
rot=lambda xs,n: nda(xs[-n:] + xs[:-n][:n] + xs[n:-n]) # rotate | |
len=lambda xs : nda([len(xs)]) # length | |
wrp=lambda xs,n: nda([nda(xs[i:i+n]) for i in range(0,len(xs),n)]) # wrap | |
rsh=lambda xs,n,*ns: nda(sum([w.rsh(*ns) for w in xs.wrp(n)],[]) if ns else xs.wrp(n)) # reshape | |
prod=lambda xs: reduce(mul, xs) # product |
goal: 66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925 | |
mine: 66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925 |
{$i xpc.inc} | |
unit romVDP; | |
interface uses romFont, SDL, SysUtils, xpc; | |
{This is a simple soft-core of a text-display processor. It features a | |
resolution of 99 columns x 40 rows and 256 colours. There exist three | |
memory areas, the character, attribute and font-data map: | |
character map (4000 byte) | |
attribute map (8000 byte) |
{$mode objfpc} | |
program recurse; | |
procedure fw( s : string; b : byte = 0 ); | |
begin | |
if b <= length( s ) then begin | |
write( s[ b ]); | |
fw( s, b+1 ) | |
end | |
end; |
{$mode objfpc} | |
unit generifaces; | |
{ Unit to demonstrate that free pascal does not complain | |
when generic types promise to implement an interface but | |
then do not. } | |
interface | |
type | |
IFoo = interface | |
function foo : byte; |
## | |
## noct : the nickelsworth oberon07 compiler/transpiler | |
## | |
## Work in progress from https://github.com/nickelsworth/noct | |
## | |
## This is the first Oberon07 program to be sucessfully | |
## translated to haxe and executed on haxe's neko vm. | |
## [0120.2013 03:36PM] | |
## |