Execute SNUSP: Difference between revisions

Content added Content deleted
m (→‎{{header|Phix}}: added syntax colouring, marked p2js compatible)
m (syntax highlighting fixup automation)
Line 6:
=={{header|11l}}==
{{trans|Python}}
<langsyntaxhighlight lang="11l">V HW = ‘
/++++!/===========?\>++.>+.+++++++..+++\
\+++\ | /+>+++++++>/ /++++++++++<<.++>./
Line 58:
step()
 
snusp(5, HW)</langsyntaxhighlight>
{{out}}
<pre>
Line 98:
 
=={{header|Icon}} and {{header|Unicon}}==
<langsyntaxhighlight lang="icon">#
# snusp.icn, A Modular SNUSP interpreter
#
Line 284:
write()
}
end</langsyntaxhighlight>
 
{{out}}
Line 293:
=={{header|J}}==
This program places no limits on the program or data size. Perhaps I'll revisit and write a tacit version of the SNUSP interpreter.
<syntaxhighlight lang="j">
<lang J>
Note 'snusp'
 
Line 347:
end.
)
</syntaxhighlight>
</lang>
Store <langsyntaxhighlight SNUSPlang="snusp">\ display JJ and linefeed, then loop forever
\ +++++++++++++++++++++++++++++++++++++\
! /+++++++++++++++++++++++++++++++++++++/
/ \..<+++++\
\ . +++++/
</langsyntaxhighlight> as J.snusp
<pre>
load'snusp.ijs' NB. the j code above
Line 373:
=={{header|Julia}}==
This Modular SNUSP interpreter uses modular calls to echo the first 2 characters entered. Try typing "Hi" at the prompt.
<langsyntaxhighlight lang="julia">const echo2 = raw"""
/==!/======ECHO==,==.==#
| |
Line 427:
end
 
snusp(100, echo2)</langsyntaxhighlight> {{output}} <pre>
> Hi
Hi
Line 435:
=={{header|Kotlin}}==
{{trans|Go}}
<langsyntaxhighlight lang="scala">// version 1.1.2
 
// requires 5 chars (10 bytes) of data store
Line 497:
fun main(args: Array<String>) {
snusp(5, hw)
}</langsyntaxhighlight>
 
{{out}}
Line 512:
=={{header|Nim}}==
{{trans|Python}}
<langsyntaxhighlight Nimlang="nim">import strutils
 
# Requires 5 bytes of data store.
Line 571:
 
when isMainModule:
snusp(5, Hw)</langsyntaxhighlight>
 
{{out}}
Line 584:
=={{header|Phix}}==
{{trans|Go}}
<!--<langsyntaxhighlight Phixlang="phix">(phixonline)-->
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
<span style="color: #004080;">integer</span> <span style="color: #000000;">id</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">0</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">ipr</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">1</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">ipc</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">1</span>
Line 646:
<span style="color: #000000;">snusp</span><span style="color: #0000FF;">(</span><span style="color: #000000;">5</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">hw</span><span style="color: #0000FF;">)</span>
<!--</langsyntaxhighlight>-->
{{out}}
<pre>
Line 657:
=={{header|Python}}==
{{trans|Go}}
<langsyntaxhighlight lang="python">#!/usr/bin/env python3
 
HW = r'''
Line 711:
 
if __name__ == '__main__':
snusp(5, HW)</langsyntaxhighlight>
{{out}}
<pre>
Line 724:
{{works with|Rakudo|2017.02}}
Implementation of modular SNUSP.
<syntaxhighlight lang="raku" perl6line>class SNUSP {
 
has @!inst-pointer;
Line 794:
 
my $snusp = SNUSP.new;
$snusp.run($hw)</langsyntaxhighlight>
{{out}}
<pre>Hello World!</pre>
Line 804:
The interpreter below implements Core SNUSP:
 
<langsyntaxhighlight lang="seed7">$ include "seed7_05.s7i";
 
const proc: snusp (in string: sourceCode, in integer: memSize, inout file: input, inout file: output) is func
Line 864:
begin
snusp(helloWorld, 5, IN, OUT);
end func;</langsyntaxhighlight>
 
{{out}}
Line 876:
=={{header|Wren}}==
{{trans|Go}}
<langsyntaxhighlight lang="ecmascript">import "io" for Stdin
 
// 'raw' is a multi-line string
Line 949:
"$+++/ | \\+++++++++>\\ \\+++++.>.+++.-----\\\n" +
" \\==-<<<<+>+++/ /=.>.+>.--------.-/"
snusp.call(5, hw)</langsyntaxhighlight>
 
{{out}}