diff options
Diffstat (limited to 'src/parser/parser.js')
-rw-r--r-- | src/parser/parser.js | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/parser/parser.js b/src/parser/parser.js index 7d3dd95..8672832 100644 --- a/src/parser/parser.js +++ b/src/parser/parser.js @@ -36,15 +36,16 @@ parser.yy = { //if (process.argv[1] === 'parser.js' && process.argv.length >= 3) { fs.readFile(process.argv[2], 'utf8', (err, data) => { if (err) throw err; - let program = parser.parse(data.toUpperCase()); - if (typeof(program.start) === "string") { - program.start = parser.yy.line[program.start]; + let result = parser.parse(data.toUpperCase()); + if (typeof(result.start) === "string") { + result.start = parser.yy.line[result.start]; } - for (let pc=0; pc<program.program.length; pc += 1) { - parser.yy.tidyAddress(pc, program.program[pc].a); - parser.yy.tidyAddress(pc, program.program[pc].b); + for (let pc=0; pc<result.program.length; pc += 1) { + parser.yy.tidyAddress(pc, result.program[pc].a); + parser.yy.tidyAddress(pc, result.program[pc].b); } - console.log(program); + console.log(result.start); + console.log(result.program); console.log(parser.yy); }); //} |