Execute Brain****: Difference between revisions

m
→‎{{header|Sidef}}: minor code fix
m (→‎{{header|Sidef}}: modified code to work with Sidef 2.10)
m (→‎{{header|Sidef}}: minor code fix)
Line 1,927:
 
func get_input {
static input_buffer = ''[];
input_buffer.len || (input_buffer = ((STDIN.readline \\ return eof_val).chomp.chars.map{.ord}));
input_buffer.shift ~~ ['', nil] ?\\ eof_val : (input_buffer -= /^(.)/s; $1.ord);
}
 
Line 1,948:
'>' => { ++cell },
'<' => { --cell },
'+' => { ++tape[cell]++ },
'-' => { --tape[cell]-- },
'.' => { tape[cell].chr.print },
',' => { tape[cell] = get_input() },
Line 1,956:
);
 
STDOUT.autoflush(1);
code = ARGF.slurp.split(1)chars.grep {|c| commands.exists(c)};
var code_len = code.len;
 
2,747

edits