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

First number in expression cannot be negative [BUG] #17

Open
PrestonHager opened this issue May 9, 2022 · 0 comments
Open

First number in expression cannot be negative [BUG] #17

PrestonHager opened this issue May 9, 2022 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@PrestonHager
Copy link
Contributor

Description

When running the calculator, the first number in a full line cannot be a negative number. In either the interpreter, JIT, or VM, it errors with the following message: called `Result::unwrap()\` on an `Err` value: Error { variant: ParsingError { positives: [EOI], negatives: [] }, location: Pos(3), line_col: Pos((1, 4)), path: None, line: "-1 + 2", continued_line: None }.

To Reproduce

  1. Run the calculator compiler by cargo run --bin repl --features vm | jit | interpreter.
  2. Give the input -NUMBER + NUMBER such as -2 + 5.
  3. Output gives an error.

Expected behavior

Instead of giving an error the interpreter should return the calculated result. For example, -2 + 5 should output 3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants