Caterpillar

Daily Thought - 2024-06-21

< back to list

Caterpillar has postfix operators, which imply a stack-based evaluation model. But Caterpillar isn't a stack-based language. (At least that's not what I would call it.) Because, while there is a "data stack" that functions operate on, it works differently than the data stacks in the stack-based languages that I've seen.

This starts with the name. I'm saying "data stack", because the context here is the difference between Caterpillar and stack-based languages. But that expression isn't even used in Caterpillar. Here, the values that are available to be operated on, are just called the "operands".

One big difference between these operands and a typical data stack, is that operands are local to a function. When you enter a function, there are no operands. While in a stack-based language, you'd have access to the same stack as the calling function. That raises the question, how are parameters passed in Caterpillar? I plan to answer that tomorrow.

<< previous thoughtnext thought >>