Skip to content

Parser does not recognize relative addressing, and pre-processor directives #14

@roerohan

Description

@roerohan

Parser does not recognize relative addressing and pre-processor directives

Addressing types

As of now, the parser is very simple and recognizes only Immediate, Register and Direct (Memory) addressing, as you can see in lexer.js. The goal is to support all types of addressing supported by Intel 8086.

Pre-processor directives

The parser does not support pre-processor instructions such as assume, or segments such as the data and the code segment. Support for this is essential for users to be able to create named procedures and store strings, etc. in the data segment.

Instruction validation

Currently, the parser does not do a lot of syntax validation, in parser.js. This might allow instructions such as:

add bx,           ; Notice the trailing comma

Stronger syntax checking needs to be implemented.

parse() {
this.rawInstructions.forEach((instruction) => {
if (instruction.length > 4) {
throw new SyntaxError();
}
if (instruction.length > 2
&& instruction[2].name !== 'SEPARATOR') {
throw new SyntaxError();
}
this.instructions.push(new Instruction({
mnemonic: instruction[0],
op1: instruction[1] || null,
op2: instruction[3] || null,
}));
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or requesthacktoberfestHacktoberfest 2020help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions