Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/arxeiss/go-expression-calculator

Custom implementation of calculator handling operator precedence and parentheses.
https://github.com/arxeiss/go-expression-calculator

ast calculator lexer parser recursive-descent recursive-descent-parser shunting-yard shuntingyard

Last synced: about 1 month ago
JSON representation

Custom implementation of calculator handling operator precedence and parentheses.

Awesome Lists containing this project

README

        

# Expression calculator in Go

Custom implementation of calculator which accept string as an input. And handles parentheses and operator precedence properly.

The idea to try implement custom expression calculator raised from the puzzle of [Day 18 of Advent of Code 2020](https://github.com/arxeiss/advent-of-code-2020/tree/master/day18).

## How to run

1. Clone repository
1. Build calculator with `make build`
1. Execute calculator with `./calculator` and show help with `./calculator --help`

## Blog posts

About each part I'm also writing article on Dev.to and my personal blog.

1. Lexer - [Dev.To](https://dev.to/arxeiss/lexer-expression-calculator-3j9p) 🇬🇧 & [kutac.cz](https://www.kutac.cz/pocitace-a-internety/lexer-1-dil-vlastni-kalkulacky-s-vyrazy) 🇨🇿
1. Shunting yard parser - [Dev.To](https://dev.to/arxeiss/shunting-yard-parser-expression-calculator-cik) 🇬🇧 & [kutac.cz](https://www.kutac.cz/pocitace-a-internety/shunting-yard-algoritmus-2-dil-vlastni-kalkulacky) 🇨🇿
1. AST & Evaluator - [Dev.To](https://dev.to/arxeiss/ast-evaluator-expression-calculator-1cdg) 🇬🇧 & [kutac.cz](https://www.kutac.cz/pocitace-a-internety/evaluator-ast-3-dil-vlastni-kalkulacky) 🇨🇿
1. Recursive descent parser - [Dev.To](https://dev.to/arxeiss/recursive-descent-parser-5581) 🇬🇧 & [kutac.cz](https://www.kutac.cz/pocitace-a-internety/recursive-descent-4-dil-vlastni-kalkulacky) 🇨🇿