← Back to context

Comment by valleyer

2 days ago

Because it's dead-simple to parse? Remember that not all machines back then had hardware call-stacks.

This approach is, arguably, more readable because it relies on a simple left-to-right evaluation. Programmers don't have to recall the complex, though often familiar, rules of operator precedence.

Would reverse Polish notation be just as easy to parse and interpret?

  • RPN is slightly easier to parse and interpret but more difficult for most humans to parse and interpret. This is the middle ground that most everyone can quickly and easily adapt to writing and reading but would still be efficient on most any system.

It’s definitely easier to parse, but you can use shunting yard to do operator precedence parsing using very little extra memory and no recursion. I feel like the language is just poorly designed.

  • To be charitable to its original designers, information was much less easily accessible in the 1960s than today-although the shunting yard algorithm had been published in the research literature in 1961, practitioners working 5-6 years later may plausibly have been unaware of it-it wasn’t like nowadays where they could easily discover it in Wikipedia or by asking an LLM.

    • Yeah, that's fair enough. I'm sure a lot of weird / bad language design choices can be chalked up to this (COBOL...). Now that C and Pascal derived languages have been around for a long time, even if you don't know about how parsers work, everyone knows that certain syntax / semantics are at least possible since they're the norm, and I suppose that wasn't the case back then.