Skip to content

joshcbrown/haculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

haculator

simple arithmetic expression repl

usage

clone this repo and run cabal run haculator.

currently, there are two major features in the repl:

  1. evaluation of arithmetic expressions consisting of only addition, subtraction, multiplication, division, negation, and parentheses;
  2. solving of linear equations involving one variable.

screenshot_2023-12-24T18:19:52

powered by haskeline, the repl allows for most features you would expect in any rich terminal interface, like scrolling through history.

roadmap

i have a few plans for the project moving forward:

  • add exponentiation and logarithms to the expression grammar
  • add the ability to solve multiple linear equations
  • make a toy programming language with the calculator as a foundation

credit

this project started as an exercise to see how far i could get parsing arithmetic expressions knowing next to nothing about programming language theory. i wrote a small amount after finishing an MVP and then read the excellent Design patterns for parser combinators (functional pearl) on recommendation. the paper largely inspired the direction of the project from that point forward, and i want to thank the authors for exposing the elegance of parser combinators so thoroughly.

About

simple repl for arithmetic expression evaluation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published