Skip to content

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

Open
@PrestonHager

Description

@PrestonHager

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions