dfintha / exprparser

Very basic expression parser written in C++.
0 stars 0 forks source link

Add proper error handling #3

Closed dfintha closed 4 months ago

dfintha commented 4 months ago

The current implementation simply returns std::nullopt on any kind of failure.

  1. Track simple source location. Right now, a simple size_t holds the character index of each token.
  2. Implement a simple result structure similar to std::result::Result or std::expected. (Can be omitted by using C++23.)
  3. Implement error types for the separate steps: tokenizer, parser, optimizer, evaluator.
  4. Use the above structure to propagate errors.
  5. Provide proper error output, describing errors.