vak: (Default)
[personal profile] vak
Оказывается, есть версия для Линукса i386, здесь: http://www.iron-spring.com/index.html

Для примера берём код известного теста Дональда Кнута "Man or boy", переписанный на PL/I.
  morb: proc options (main) reorder;
dcl sysprint file;

dcl i fixed bin (31);

do i = 0 to 15;
put skip edit('i = ', i, a((i), x1, x2, x3, x4, x5))
(a(4), p'z9b', P'---,---,--9');
end;

a: proc(k, y1, y2, y3, y4, y5) returns(fixed bin (31)) recursive;
dcl k fixed bin (31);
dcl (y1, y2, y3, y4, y5) entry returns(fixed bin (31));

b: proc returns(fixed bin(31)) recursive;
k = k - 1;
return(a((k), b, y1, y2, y3, y4));
end b;

if k <= 0 then
return(y4 + y5);
else
return(b);
end a;

x1: proc returns(fixed bin (31)); return(1); end x1;
x2: proc returns(fixed bin (31)); return(-1); end x2;
x3: proc returns(fixed bin (31)); return(-1); end x3;
x4: proc returns(fixed bin (31)); return(1); end x4;
x5: proc returns(fixed bin (31)); return(0); end x5;
end morb;
Компилируем, запускаем.
$ plic morb.pli -o morb.o
$ ld -melf_i386 -z muldefs -Bstatic -e main morb.o -lprf -o morb
$ size morb
text data bss dec hex filename
167800 112896 528 281224 44a88 morb
$ ./morb

i = 0 1
i = 1 0
i = 2 -2
i = 3 0
i = 4 1
i = 5 0
i = 6 1
i = 7 -1
i = 8 -10
i = 9 -30
i = 10 -67
i = 11 -138
i = 12 -291
i = 13 -642
i = 14 -1,446
i = 15 -3,250

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org