langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
114
Task/Quine/NetRexx/quine.netrexx
Normal file
114
Task/Quine/NetRexx/quine.netrexx
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
/* NetRexx */
|
||||
options replace format comments java crossref savelog symbols nobinary
|
||||
|
||||
Q = "'"
|
||||
S = "\\"
|
||||
N = "\n"
|
||||
A = "&"
|
||||
code = [ -
|
||||
'/* NetRexx */', -
|
||||
'options replace format comments java crossref savelog symbols nobinary', -
|
||||
'', -
|
||||
'Q = "&QS"', -
|
||||
'S = "&ESC"', -
|
||||
'N = "&NL"', -
|
||||
'A = "&"', -
|
||||
'code = [ -', -
|
||||
'&REP', -
|
||||
' ]', -
|
||||
'', -
|
||||
'pgm = ""', -
|
||||
'txt = ""', -
|
||||
'loop t_ = 0 for code.length', -
|
||||
' txt = txt || " " || Q || code[t_] || Q || ", -" || N', -
|
||||
' end t_', -
|
||||
'txt = txt.strip("T", N)', -
|
||||
'txt = txt.delstr(txt.lastpos(","), 1)', -
|
||||
'', -
|
||||
'K = ""', -
|
||||
'K[0] = 5', -
|
||||
'K[1] = A"NL"', -
|
||||
'K[2] = A"AMP"', -
|
||||
'K[3] = A"ESC"', -
|
||||
'K[4] = A"QS"', -
|
||||
'K[5] = A"REP"', -
|
||||
'loop c_ = 0 for code.length', -
|
||||
' loop v_ = 1 to K[0]', -
|
||||
' T = K[v_]', -
|
||||
' if code[c_].pos(T) <> 0 then do', -
|
||||
' parse code[c_] pre(T)post', -
|
||||
' select case T', -
|
||||
' when K[1] then do', -
|
||||
' code[c_] = pre || S || "n" || post', -
|
||||
' end', -
|
||||
' when K[2] then do', -
|
||||
' code[c_] = pre || A || post', -
|
||||
' end', -
|
||||
' when K[3] then do', -
|
||||
' code[c_] = pre || S || S || post', -
|
||||
' end', -
|
||||
' when K[4] then do', -
|
||||
' code[c_] = pre || Q || post', -
|
||||
' end', -
|
||||
' when K[5] then do', -
|
||||
' code[c_] = txt', -
|
||||
' end', -
|
||||
' otherwise nop', -
|
||||
' end', -
|
||||
' end', -
|
||||
' end v_', -
|
||||
' pgm = pgm || code[c_].strip("T") || N', -
|
||||
' end c_', -
|
||||
'pgm = pgm.strip("T", N) || N', -
|
||||
'say pgm', -
|
||||
'', -
|
||||
'return', -
|
||||
'' -
|
||||
]
|
||||
|
||||
pgm = ""
|
||||
txt = ""
|
||||
loop t_ = 0 for code.length
|
||||
txt = txt || " " || Q || code[t_] || Q || ", -" || N
|
||||
end t_
|
||||
txt = txt.strip("T", N)
|
||||
txt = txt.delstr(txt.lastpos(","), 1)
|
||||
|
||||
K = ""
|
||||
K[0] = 5
|
||||
K[1] = A"NL"
|
||||
K[2] = A"AMP"
|
||||
K[3] = A"ESC"
|
||||
K[4] = A"QS"
|
||||
K[5] = A"REP"
|
||||
loop c_ = 0 for code.length
|
||||
loop v_ = 1 to K[0]
|
||||
T = K[v_]
|
||||
if code[c_].pos(T) <> 0 then do
|
||||
parse code[c_] pre(T)post
|
||||
select case T
|
||||
when K[1] then do
|
||||
code[c_] = pre || S || "n" || post
|
||||
end
|
||||
when K[2] then do
|
||||
code[c_] = pre || A || post
|
||||
end
|
||||
when K[3] then do
|
||||
code[c_] = pre || S || S || post
|
||||
end
|
||||
when K[4] then do
|
||||
code[c_] = pre || Q || post
|
||||
end
|
||||
when K[5] then do
|
||||
code[c_] = txt
|
||||
end
|
||||
otherwise nop
|
||||
end
|
||||
end
|
||||
end v_
|
||||
pgm = pgm || code[c_].strip("T") || N
|
||||
end c_
|
||||
pgm = pgm.strip("T", N) || N
|
||||
say pgm
|
||||
|
||||
return
|
||||
1
Task/Quine/OCaml/quine-1.ocaml
Normal file
1
Task/Quine/OCaml/quine-1.ocaml
Normal file
|
|
@ -0,0 +1 @@
|
|||
(fun p -> Printf.printf p (string_of_format p)) "(fun p -> Printf.printf p (string_of_format p)) %S;;\n";;
|
||||
1
Task/Quine/OCaml/quine-2.ocaml
Normal file
1
Task/Quine/OCaml/quine-2.ocaml
Normal file
|
|
@ -0,0 +1 @@
|
|||
(fun s -> Printf.printf "%s%S;;\n" s s) "(fun s -> Printf.printf \"%s%S;;\\n\" s s) ";;
|
||||
5
Task/Quine/OxygenBasic/quine.oxy
Normal file
5
Task/Quine/OxygenBasic/quine.oxy
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
'RUNTIME COMPILING
|
||||
|
||||
source="print source"
|
||||
|
||||
a=compile source : call a : freememory a
|
||||
1
Task/Quine/Oz/quine.oz
Normal file
1
Task/Quine/Oz/quine.oz
Normal file
|
|
@ -0,0 +1 @@
|
|||
declare I in thread {System.showInfo I#[34]#I#[34]} end I ="declare I in thread {System.showInfo I#[34]#I#[34]} end I ="
|
||||
12
Task/Quine/PL-I/quine-1.pli
Normal file
12
Task/Quine/PL-I/quine-1.pli
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
s:proc options(main)reorder;dcl sysprint file,m(7)init(
|
||||
' s:proc options(main)reorder\dcl sysprint file,m(7)init(',
|
||||
' *)char(99),i,j,(translate,substr)builtin,c char\i=1\j=n',
|
||||
' \do i=1 to 6\put skip list('' '''''')\do j=2 to 56\c=substr',
|
||||
' (m(i),j)\put edit(c)(a)\n:proc\put list(translate(m(i),',
|
||||
' ''5e''x,''e0''x))\end n\if c='''''''' then put edit(c)(a)\end\ ',
|
||||
' put edit('''''','')(a(50))\end\do i=2 to 6\j=n\end\end s\ ',
|
||||
*)char(99),i,j,(translate,substr)builtin,c char;i=1;j=n
|
||||
;do i=1 to 6;put skip list(' ''');do j=2 to 56;c=substr
|
||||
(m(i),j);put edit(c)(a);n:proc;put list(translate(m(i),
|
||||
'5e'x,'e0'x));end n;if c='''' then put edit(c)(a);end;
|
||||
put edit(''',')(a(50));end;do i=2 to 6;j=n;end;end s;
|
||||
4
Task/Quine/PL-I/quine-2.pli
Normal file
4
Task/Quine/PL-I/quine-2.pli
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
%dcl z%z='put edit';proc options(main;q=''''put list(m;do i=1,2;z(q)skip;do j=
|
||||
1to 78c=substr(m(i),j;if c=q z(c;z(c;end;z(q',';dcl(c,q)char,m(2)char(99)init(
|
||||
'%dcl z%z=''put edit'';proc options(main;q=''''''''put list(m;do i=1,2;z(q)skip;do j=',
|
||||
'1to 78c=substr(m(i),j;if c=q z(c;z(c;end;z(q'','';dcl(c,q)char,m(2)char(99)init(',
|
||||
6
Task/Quine/PL-I/quine-3.pli
Normal file
6
Task/Quine/PL-I/quine-3.pli
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
%dcl z;%z="put edit";w:proc options(main);q="'";put list(m)do i=1,2,3;z
|
||||
(q)(a)skip;do j=1to 71;c=substr(m(i),j)if c=q then z(c)(a)z(c)(a)end;if
|
||||
i<3then z(q,",")(a)else z(q,";")(a)end;dcl(c,q)char,m(3)char(99)init(
|
||||
'%dcl z;%z="put edit";w:proc options(main);q="''";put list(m)do i=1,2,3;z',
|
||||
'(q)(a)skip;do j=1to 71;c=substr(m(i),j)if c=q then z(c)(a)z(c)(a)end;if',
|
||||
'i<3then z(q,",")(a)else z(q,";")(a)end;dcl(c,q)char,m(3)char(99)init( ';
|
||||
1
Task/Quine/Pascal/quine.pascal
Normal file
1
Task/Quine/Pascal/quine.pascal
Normal file
|
|
@ -0,0 +1 @@
|
|||
const s=';begin writeln(#99#111#110#115#116#32#115#61#39,s,#39,s)end.';begin writeln(#99#111#110#115#116#32#115#61#39,s,#39,s)end.
|
||||
1
Task/Quine/Perl-6/quine.pl6
Normal file
1
Task/Quine/Perl-6/quine.pl6
Normal file
|
|
@ -0,0 +1 @@
|
|||
my &f = {say $^s, $^s.perl;}; f "my \&f = \{say \$^s, \$^s.perl;}; f "
|
||||
2
Task/Quine/PlainTeX/quine-1.tex
Normal file
2
Task/Quine/PlainTeX/quine-1.tex
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
This is TeX, Version 3.1415926 (no format preloaded)
|
||||
(q.tex \output {\message {\output \the \output \end }\batchmode }\end
|
||||
2
Task/Quine/PlainTeX/quine-2.tex
Normal file
2
Task/Quine/PlainTeX/quine-2.tex
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
\let~\expandafter\def\0{~\ttraggedright~\let~\s~\string~\def~~~{~\s~~~\s~}~\output~
|
||||
~{~}~\s~\let~~~\expandafter~\s~\def~\s~\0~\s~{~\0~\s~}~\s~\0~\end}\0
|
||||
39
Task/Quine/PowerBASIC/quine.powerbasic
Normal file
39
Task/Quine/PowerBASIC/quine.powerbasic
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
FUNCTION PBMAIN () AS LONG
|
||||
REDIM s(1 TO DATACOUNT) AS STRING
|
||||
o$ = READ$(1)
|
||||
d$ = READ$(2)
|
||||
FOR n& = 1 TO DATACOUNT
|
||||
s(n&) = READ$(n&)
|
||||
NEXT
|
||||
OPEN o$ FOR OUTPUT AS 1
|
||||
FOR n& = 3 TO DATACOUNT - 1
|
||||
PRINT #1, s(n&)
|
||||
NEXT
|
||||
PRINT #1,
|
||||
FOR n& = 1 TO DATACOUNT
|
||||
PRINT #1, d$ & $DQ & s(n&) & $DQ
|
||||
NEXT
|
||||
PRINT #1, s(DATACOUNT)
|
||||
CLOSE
|
||||
|
||||
DATA "output.src"
|
||||
DATA " DATA "
|
||||
DATA "FUNCTION PBMAIN () AS LONG"
|
||||
DATA " REDIM s(1 TO DATACOUNT) AS STRING"
|
||||
DATA " o$ = READ$(1)"
|
||||
DATA " d$ = READ$(2)"
|
||||
DATA " FOR n& = 1 TO DATACOUNT"
|
||||
DATA " s(n&) = READ$(n&)"
|
||||
DATA " NEXT"
|
||||
DATA " OPEN o$ FOR OUTPUT AS 1"
|
||||
DATA " FOR n& = 3 TO DATACOUNT - 1"
|
||||
DATA " PRINT #1, s(n&)"
|
||||
DATA " NEXT"
|
||||
DATA " PRINT #1,"
|
||||
DATA " FOR n& = 1 TO DATACOUNT"
|
||||
DATA " PRINT #1, d$ & $DQ & s(n&) & $DQ"
|
||||
DATA " NEXT"
|
||||
DATA " PRINT #1, s(DATACOUNT)"
|
||||
DATA " CLOSE"
|
||||
DATA "END FUNCTION"
|
||||
END FUNCTION
|
||||
2
Task/Quine/PowerShell/quine.psh
Normal file
2
Task/Quine/PowerShell/quine.psh
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
$d='$d={0}{1}{0}{2}Write-Host -NoNewLine ($d -f [char]39,$d,"`r`n")'
|
||||
Write-Host -NoNewLine ($d -f [char]39,$d,"`r`n")
|
||||
1
Task/Quine/PureBasic/quine.purebasic
Normal file
1
Task/Quine/PureBasic/quine.purebasic
Normal file
|
|
@ -0,0 +1 @@
|
|||
s$="s$= : Debug Mid(s$,1,3)+Chr(34)+s$+Chr(34)+Mid(s$,4,100)" : Debug Mid(s$,1,3)+Chr(34)+s$+Chr(34)+Mid(s$,4,100)
|
||||
1
Task/Quine/REBOL/quine.rebol
Normal file
1
Task/Quine/REBOL/quine.rebol
Normal file
|
|
@ -0,0 +1 @@
|
|||
rebol [] q: [print ["rebol [] q:" mold q "do q"]] do q
|
||||
24
Task/Quine/Seed7/quine.seed7
Normal file
24
Task/Quine/Seed7/quine.seed7
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
$ include "seed7_05.s7i";
|
||||
const array string: prog is [](
|
||||
"$ include \"seed7_05.s7i\";",
|
||||
"const array string: prog is [](",
|
||||
"const proc: main is func",
|
||||
" local var integer: number is 0;",
|
||||
" begin",
|
||||
" for number range 1 to 2 do writeln(prog[number]); end for;",
|
||||
" for number range 1 to 11 do",
|
||||
" writeln(literal(prog[number]) <& \",\");",
|
||||
" end for;",
|
||||
" writeln(literal(prog[12]) <& \");\");",
|
||||
" for number range 3 to 12 do writeln(prog[number]); end for;",
|
||||
" end func;");
|
||||
const proc: main is func
|
||||
local var integer: number is 0;
|
||||
begin
|
||||
for number range 1 to 2 do writeln(prog[number]); end for;
|
||||
for number range 1 to 11 do
|
||||
writeln(literal(prog[number]) <& ",");
|
||||
end for;
|
||||
writeln(literal(prog[12]) <& ");");
|
||||
for number range 3 to 12 do writeln(prog[number]); end for;
|
||||
end func;
|
||||
1
Task/Quine/Standard-ML/quine.ml
Normal file
1
Task/Quine/Standard-ML/quine.ml
Normal file
|
|
@ -0,0 +1 @@
|
|||
(fn s => print (s ^ "\"" ^ String.toString s ^ "\";\n")) "(fn s => print (s ^ \"\\\"\" ^ String.toString s ^ \"\\\";\\n\")) ";
|
||||
6
Task/Quine/TXR/quine-1.txr
Normal file
6
Task/Quine/TXR/quine-1.txr
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
@(deffilter me ("ME" "@(bind me "ME") @(output) @@(deffilter me ("ME" "@{me :filter me}")) @{me :filter (me :from_html)} @(end)"))
|
||||
@(bind me "ME")
|
||||
@(output)
|
||||
@@(deffilter me ("ME" "@{me :filter me}"))
|
||||
@{me :filter (me :from_html)}
|
||||
@(end)
|
||||
5
Task/Quine/TXR/quine-2.txr
Normal file
5
Task/Quine/TXR/quine-2.txr
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
@(bind me "@(output) @@(bind me "@me") @{me :filter :from_html} @(end)")
|
||||
@(output)
|
||||
@@(bind me "@me")
|
||||
@{me :filter :from_html}
|
||||
@(end)
|
||||
7
Task/Quine/TXR/quine-3.txr
Normal file
7
Task/Quine/TXR/quine-3.txr
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
@(bind me ("@(output)" "@@(bind me (@(rep)"@me" @(last)"@me"@(end)))" "@(repeat)" "@{me :filter :from_html}" "@(end)" "@(end)"))
|
||||
@(output)
|
||||
@@(bind me (@(rep)"@me" @(last)"@me"@(end)))
|
||||
@(repeat)
|
||||
@{me :filter :from_html}
|
||||
@(end)
|
||||
@(end)
|
||||
8
Task/Quine/TXR/quine-4.txr
Normal file
8
Task/Quine/TXR/quine-4.txr
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
@(bind me ("@(deffilter q (*'**'*' *'*/*'*') (*'**/*' *'*/*/*') (*'*****' *'***'))" "@(output)" "@@(bind me (@(rep)*'@me*' @(last)*'@me*'@(end)))" "@(repeat)" "@{me :filter q}" "@(end)" "@(end)"))
|
||||
@(deffilter q ("*'" "\"") ("*/" "\\") ("**" "*"))
|
||||
@(output)
|
||||
@@(bind me (@(rep)"@me" @(last)"@me"@(end)))
|
||||
@(repeat)
|
||||
@{me :filter q}
|
||||
@(end)
|
||||
@(end)
|
||||
2
Task/Quine/UNIX-Shell/quine-1.sh
Normal file
2
Task/Quine/UNIX-Shell/quine-1.sh
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
cat -- "$0"
|
||||
14
Task/Quine/UNIX-Shell/quine-2.sh
Normal file
14
Task/Quine/UNIX-Shell/quine-2.sh
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
string=`cat`
|
||||
printf "$string" "$string"
|
||||
echo
|
||||
echo END-FORMAT
|
||||
} <<'END-FORMAT'
|
||||
{
|
||||
string=`cat`
|
||||
printf "$string" "$string"
|
||||
echo
|
||||
echo END-FORMAT
|
||||
} <<'END-FORMAT'
|
||||
%s
|
||||
END-FORMAT
|
||||
1
Task/Quine/V/quine-1.v
Normal file
1
Task/Quine/V/quine-1.v
Normal file
|
|
@ -0,0 +1 @@
|
|||
[p [put ' 'put] map ' ' puts].
|
||||
2
Task/Quine/V/quine-2.v
Normal file
2
Task/Quine/V/quine-2.v
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
[dup puts p]
|
||||
dup puts p
|
||||
2
Task/Quine/V/quine-3.v
Normal file
2
Task/Quine/V/quine-3.v
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
[dup puts p]
|
||||
dup puts p
|
||||
40
Task/Quine/VHDL/quine.vhdl
Normal file
40
Task/Quine/VHDL/quine.vhdl
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
LIBRARY ieee; USE std.TEXTIO.all;
|
||||
entity quine is end entity quine;
|
||||
architecture beh of quine is
|
||||
type str_array is array(1 to 20) of string(1 to 80);
|
||||
constant src : str_array := (
|
||||
"LIBRARY ieee; USE std.TEXTIO.all; ",
|
||||
"entity quine is end entity quine; ",
|
||||
"architecture beh of quine is ",
|
||||
" type str_array is array(1 to 20) of string(1 to 80); ",
|
||||
" constant src : str_array := ( ",
|
||||
"begin ",
|
||||
" process variable l : line; begin ",
|
||||
" for i in 1 to 5 loop write(l, src(i)); writeline(OUTPUT, l); end loop; ",
|
||||
" for i in 1 to 20 loop ",
|
||||
" write(l, character'val(32)&character'val(32)); ",
|
||||
" write(l, character'val(32)&character'val(32)); ",
|
||||
" write(l, character'val(34)); write(l, src(i)); write(l,character'val(34));",
|
||||
" if i /= 20 then write(l, character'val(44)); ",
|
||||
" else write(l, character'val(41)&character'val(59)); end if; ",
|
||||
" writeline(OUTPUT, l); ",
|
||||
" end loop; ",
|
||||
" for i in 6 to 20 loop write(l, src(i)); writeline(OUTPUT, l); end loop; ",
|
||||
" wait; ",
|
||||
" end process; ",
|
||||
"end architecture beh; ");
|
||||
begin
|
||||
process variable l : line; begin
|
||||
for i in 1 to 5 loop write(l, src(i)); writeline(OUTPUT, l); end loop;
|
||||
for i in 1 to 20 loop
|
||||
write(l, character'val(32)&character'val(32));
|
||||
write(l, character'val(32)&character'val(32));
|
||||
write(l, character'val(34)); write(l, src(i)); write(l,character'val(34));
|
||||
if i /= 20 then write(l, character'val(44));
|
||||
else write(l, character'val(41)&character'val(59)); end if;
|
||||
writeline(OUTPUT, l);
|
||||
end loop;
|
||||
for i in 6 to 20 loop write(l, src(i)); writeline(OUTPUT, l); end loop;
|
||||
wait;
|
||||
end process;
|
||||
end architecture beh;
|
||||
Loading…
Add table
Add a link
Reference in a new issue