r/functionalprogramming • • Dec 23 '22

Python Functional Implementation of a parser?

How do i implement a parser in functional pattern?

For instance I want parse a simple math parser like this:

"1 * 2 + 3" -> ast

How do implement the parser for that in pure functional pattern?

22 Upvotes

11 comments sorted by

View all comments

Show parent comment

3

u/ketalicious Dec 24 '22

thanks for this!

2

u/ramin-honary-xc Dec 24 '22

You're welcome. Although I realized too late that you were posting your question in r/functionalprogramming and not r/haskell so I wrote a very Haskell-specific response. But yeah, this is how we do it in Haskell, so I hope that made sense.