Add TextWriter, IOException, per-VM module data and pre-load imports; Add console module with Console class
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'console';
|
||||
class Brainfuck {
|
||||
private string $code;
|
||||
private int $code_pointer;
|
||||
@@ -18,7 +19,7 @@ class Brainfuck {
|
||||
$this->interpret($this->code[$this->code_pointer]);
|
||||
$this->code_pointer++;
|
||||
}
|
||||
print($this->output);
|
||||
Console::Print($this->output);
|
||||
}
|
||||
|
||||
private void interpret(string $command) {
|
||||
@@ -95,11 +96,11 @@ class Program {
|
||||
sort($files);
|
||||
unset($file);
|
||||
for(int $n = 0; $n < sizeof($files); $n++) {
|
||||
print('Executing "' + $files[$n] + '"' + "\n");
|
||||
Console::Print('Executing "' + $files[$n] + '"' + "\n");
|
||||
$code = file_get_contents('tests/data/brainfuck/' + $files[$n]);
|
||||
$bf = new Brainfuck($code, $input);
|
||||
$bf->run();
|
||||
print("\n");
|
||||
Console::Print("\n");
|
||||
}
|
||||
closedir($dir);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user