Stack-oriented programming

Programming paradigm that relies on a stack machine model / From Wikipedia, the free encyclopedia

Dear Wikiwand AI, let's keep it short by simply answering these key questions:

Can you list the top facts and stats about Stack-oriented programming?

Summarize this article for a 10 years old


Stack-oriented programming is a programming paradigm that relies on a stack machine model for passing parameters. Stack-oriented programming languages operate on one or more stacks, each of which may serve a different purpose. Programming constructs in other programming languages need to be modified for use in a stack-oriented system.[1] Most stack-oriented languages operate in postfix or Reverse Polish notation. Any arguments or parameters for a command are stated before that command. For example, postfix notation would be written 2, 3, multiply instead of multiply, 2, 3 (prefix or Polish notation), or 2 multiply 3 (infix notation). The programming languages Forth, Factor, RPL, PostScript, BibTeX style design language[2] and many assembly languages fit this paradigm.

Stack-based algorithms consider data, by utilising one piece of data from atop the stack, and returning data back atop the stack. The need for stack manipulation operators, allow for the stack to manipulate data. To emphasise the effect of a statement, a comment is used showing the top of the stack before and after the statement. This is known as the stack effect diagram. Postscript stacks consider separate stacks for additional purposes. This considers variables, dictionaries, procedures, anatomy of some typical procedures, control and flow. The analysis of the language model allows expressions and programs to be interpreted simply and theoretically.