Stack-based language: Difference between revisions

Content deleted Content added
Andyo (talk | contribs)
No edit summary
m Bot: Fixing double redirect to Stack-oriented programming
Tag: Redirect target changed
 
(5 intermediate revisions by 4 users not shown)
Line 1:
#REDIRECT [[Stack-oriented programming]]
In [[computer science]], a '''stack-based language''' is a [[computer language]] that uses the [[Stack (computing)|stack]] to store intermediate results during computation. [[Forth]] and [[Java programming language|Java]] [[byte-code]] are examples of stack-based languages.
 
A stack-based language tends to be used as intermediate representation of a program during its compilation.
 
== Example ==
 
A piece of code to compute the sum of 10 * (20 + 30) would be like:
 
<pre>
push 10 // push 10 onto the stack
push 20 // push 20
push 20 // push 30
add // pop two values from the stack, and push its sum
mul // pop two values from the stack, and push its sum
</pre>
 
{{compu-stub}}