create-your-own-lang-with-rust icon indicating copy to clipboard operation
create-your-own-lang-with-rust copied to clipboard

First number in expression cannot be negative [BUG]

Open PrestonHager opened this issue 2 years ago • 0 comments

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.

PrestonHager avatar May 09 '22 04:05 PrestonHager