diff options
author | sanine-a <sanine.not@pm.me> | 2023-05-23 14:53:53 -0500 |
---|---|---|
committer | sanine-a <sanine.not@pm.me> | 2023-05-23 14:53:53 -0500 |
commit | 15323007750e0f0f7c36a6a6fa01ad1d303a4a16 (patch) | |
tree | 70835b4364299274dc0145af5cd41c5af05ae53b /src/main.js | |
parent | 29ed5eacb80cdfe49bff0d9335241dc3e2188981 (diff) |
implement basic vm runner
Diffstat (limited to 'src/main.js')
-rw-r--r-- | src/main.js | 23 |
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)); |