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

constructor can't initialize a private variable for some reason
No edit summary
(constructor can't initialize a private variable for some reason)
Line 1:
<lang perl6>class BFInterpreter {
has @!.code;
has @!mem;
has @!loop_stack;
Line 14:
$!c = 0;
$!m = 0;
while $!c < @!.code {
given @!.code[$!c] {
when '>' { $!m++ }
when '<' { $!m-- }
Line 41:
while $depth {
$!c++;
die "unbalanced code" if $!c >= @!.code.elems;
$depth++ if @!.code[$!c] eq '[';
$depth-- if @!.code[$!c] eq ']';
}
}
1,934

edits