module NaiveMather

Overview

Calculates simple math equations, like "2 + 3 * (2 + 4)" Based on Ruby code written for blog by Lukasz Wrobel. https://lukaszwrobel.pl/blog/math-parser-part-3-implementation/

Defined in:

naive_mather.cr
naive_mather/lexer.cr
naive_mather/parser.cr
naive_mather/token.cr
naive_mather/version.cr

Constant Summary

DEBUG = false
VERSION = "0.1.0"

Class Method Summary

Class Method Detail

def self.calculate(equation : String | Nil) #

Returns the result of calculating the passed equation.

NativeMather.calculate("2 + 3") # => 5

[View source]