Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
roerohan opened this issue Sep 23, 2020 · 0 comments
Labels
bug Something isn't working enhancement New feature or request hacktoberfest Hacktoberfest 2020 help wanted Extra attention is needed

Comments

@roerohan
Copy link
Owner

roerohan commented Sep 23, 2020

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,
}));
});

@roerohan roerohan added bug Something isn't working enhancement New feature or request help wanted Extra attention is needed hacktoberfest Hacktoberfest 2020 labels Sep 23, 2020
@roerohan roerohan pinned this issue Sep 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request hacktoberfest Hacktoberfest 2020 help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant