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

Improve assembler error messages #69

Open
jamesyoungman opened this issue May 16, 2022 · 0 comments
Open

Improve assembler error messages #69

jamesyoungman opened this issue May 16, 2022 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@jamesyoungman
Copy link
Contributor

Is your feature request related to a problem? Please describe.

The assembler's error-handling strategy is modeled after https://eyalkalderon.com/blog/nom-error-recovery/ but our use of the "placeholder" denoting that we came across an invalid input is not comprehensive.

For example, this line of input is perfectly valid:

100|      REX₆₆   200     ** Set X₆₆ to 200.

If we add an extra symbol in there like this:

100|      REX₆₆   EXTRA 200     ** Set X₆₆ to 200.

We get a somewhat confusing error:

11:508: expected newline after a program instruction
11:508: expected end-of-file
2022-05-16T08:51:58.375986Z ERROR assemble{input="assembler/examples/hello.tx2as" output="hello.tape"}: tx2m4as: assembly failed: AsmFail(SyntaxError { line: 11, columns: Some((508, 3505)), msg: "expected newline after a program instruction" })
line 11, column 509: expected newline after a program instruction

Describe the solution you'd like
An error message which is more understandable, making use of the existing LocatedSpan code to show the invalid/unsupported input.

Describe alternatives you've considered
I'm hoping that the overall pattern described in Eyal Kalderon's blog post will be sufficient to give a good user experience.

Additional context
See above for an example output.

@jamesyoungman jamesyoungman added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels May 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant