Hacker News new | ask | show | jobs
by stdcall83 2491 days ago
Nicely done. did you using shunting yard algorithm for parsing the expressions?

I also developed developers calculator, but I didn't add support for float as you did. https://www.github.com/mellowcandle/bitwise

1 comments

Thank you :)

Sorry, no. I used to be really into parsing algorithms and tools, and I still consider them useful for more mundane tasks. But the last thing I need when exploring the syntax of a new language is someone else's arbitrary limitations.

My language parsers [0] tend to be rather messy recursive-decentish creations. But I think that's fine; since in a new language the syntax should be allowed to move around freely, and prematurely nailing it to the floor to check a box isn't really going to help anyone.

What usually happens is I'll tighten the parser as needed along the way when I feel confident enough. Which brings us to the issue with parsing tools, they're all in from the start rather than gradual.

https://github.com/codr7/g-fu/blob/master/v1/src/gfu/read.go

https://github.com/codr7/cidk/blob/master/src/cidk/read.cpp