Execute Brain****: Difference between revisions

added RPL
(Add R example)
(added RPL)
Line 7,069:
<pre>
Hello World!
</pre>
 
=={{header|RPL}}==
« 3000 DUP { } + 0 CON 'Tape' STO "" 'StdOut' STO 1
{ « 1 + »
« 1 - »
« 'Tape' OVER DUP2 GET 1 + PUT »
« 'Tape' OVER DUP2 GET 1 - PUT »
« StdOut 'Tape' 3 PICK GET CHR + 'StdOut' STO »
« 'Tape' OVER '''DO UNTIL''' KEY '''END''' PUT »
« '''IF''' 'Tape' OVER GET NOT '''THEN'''
1 CF
'''DO''' pgm pptr 1 + DUP 'pptr' STO DUP SUB
'''IF''' DUP "" == OVER "]" == OR '''THEN''' 1 SF '''END'''
'''UNTIL''' 1 FS? '''END END''' »
« '''IF''' 'Tape' OVER GET '''THEN'''
1 CF
'''DO''' pgm pptr 1 - DUP 'pptr' STO DUP SUB
'''IF''' DUP "" == '''THEN''' 1 SF pgm SIZE 'pptr' STO '''END'''
'''IF''' "[" == '''THEN''' 1 SF '''END'''
'''UNTIL''' 1 FS? '''END END''' »
}
→ pgm mmax pptr code
« 1
'''DO''' "><+-.,[]" pgm pptr DUP SUB POS
'''IF''' DUP '''THEN''' code SWAP GET EVAL '''ELSE''' DROP '''END'''
pptr 1 + 'pptr' STO
'''UNTIL''' DUP NOT OVER mmax > OR pptr pgm SIZE > OR '''END'''
DROP StdOut
{ 'Tape' 'StdOut'} PURGE
» » '<span style="color:blue">BRAIN</span>' STO
 
"++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>." <span style="color:blue">BRAIN</span>
{{out}}
<pre>
1: "Hello world!"
</pre>
 
1,150

edits