Execute Brain****/Raku: Difference between revisions

m
Fixed syntax highlighting and added line numbers.
(constructor can't initialize a private variable for some reason)
m (Fixed syntax highlighting and added line numbers.)
 
(2 intermediate revisions by one other user not shown)
Line 1:
{{works with|Rakudo|2018.03}}
<syntaxhighlight lang="raku" perl6line>class BFInterpreter {
has @.code;
has @!mem;
Line 8 ⟶ 9:
 
method new (Str $code) {
BFInterpreter.bless(*,code => $code.lines.comb);
}
 
Line 46 ⟶ 47:
}
}
}
}</lang>
 
# Test: "Hello World" program:
 
<lang perl6>my $code = "++++++++++
[>+++++++>++++++++++>+++>+<<<<-]
>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.
Line 55 ⟶ 57:
 
my $bfi = BFInterpreter.new($code);
$bfi.run;</syntaxhighlight>
</lang>
9,477

edits