Crate calc_parser

source ·
Expand description

Crate for tokenizing, lexing, and parsing for the calc project. This crate uses a simple stack algorithm to do order of operations. Unlike many algorithms, this parser does not create a parse tree and instead does the evaluation on the fly.

Lexing can be done with the Lexer type. Parsing can then be done with the parse_and_evaluate function.

Modules

Structs

  • Represents a simple expression eg. 9+10 or -5
  • An error for when a number is too large to fit into a number type

Enums

Traits

  • A trait for Zero-Sized-Types that can evaluate expressions

Functions