summaryrefslogtreecommitdiff
path: root/src/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.js')
-rw-r--r--src/main.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/main.js b/src/main.js
new file mode 100644
index 0000000..ec74ee7
--- /dev/null
+++ b/src/main.js
@@ -0,0 +1,23 @@
+'use strict';
+
+const process = require('node:process');
+const fs = require('node:fs');
+
+const { assemble } = require('./parser/parser.js');
+const { RedcodeVm } = require('./vm/vm.js');
+
+
+const files = process.argv.slice(2);
+if (files.length === 0) {
+ console.log("no input files provided!");
+}
+
+
+const warriors = files.map(fname => {
+ const source = fs.readFileSync(fname, 'utf8');
+ return assemble(source);
+});
+
+
+const vm = new RedcodeVm(8000, warriors);
+console.log(vm.run(100000));