On 2023年01月17日 01:54, Foster Schucker wrote:
One of the things I try to do when learning a new language is how to make a 4 function calculator. Roberto has posted an intro to his Building a Programming Language class https://www.youtube.com/playlist?list=PLXPoQXrP0261ceYEnDd5LaZy2UM_4hLae and uses LPEG to do pattern matching. I would not have thought of it as a way to do a simple (or complex) calculator. A good example set if you've never used LPEG (like me)
I have coded a simple calculator while learning compilation theory. It has been pushed towards my GitHub repository[1]. Hope that helps. -- Ziyao [1]: https://github.com/ziyao233/code/blob/main/Lua/Calculator.lua