Skip to content
This repository has been archived by the owner on Oct 1, 2021. It is now read-only.

A simple Parser (using Monadic Parsing) for mathematical expressions in Haskell.

License

Notifications You must be signed in to change notification settings

timmyjose-compilers/mathematical-expressions-haskell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mathematical-expressions-haskell

A simple parser for mathematical expressions in Haskell, using Monadic Parsing.

Based on the following EBNF grammar:

expr ::= term (+ expr | - expr | epsilon)

term ::= pow (* term | / term | epsilon)

pow ::= factor (^ pow | epsilon)

factor ::= ( expr ) | integer

integer ::= digit digit*

digit ::= [0-9]

This grammar (modified) is due to Graham Hutton's book, "Programming in Haskell" (2nd Edition). Check the companion repository, mathematical-expressions-java for the comparative implementation in Java, using a Recursive-Descent parser.

Build and Run

To build the project, execute the following command:

$ stack clean && stack build

To run the project, execute:

$ stack exec mathematical-expressions-haskell-exe

About

A simple Parser (using Monadic Parsing) for mathematical expressions in Haskell.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published