Add TextWriter, IOException, per-VM module data and pre-load imports; Add console module with Console class

This commit is contained in:
2026-11-23 18:36:46 +01:00
parent 2243557bf5
commit 4d06edd045
55 changed files with 1679 additions and 675 deletions
+4 -3
View File
@@ -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);
}