This page (revision-82) was last changed on 03-Jan-2024 15:31 by bartgo 

This page was created on 20-Feb-2010 20:56 by Carsten Strotmann

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Page revision history

Version Date Modified Size Author Changes ... Change note
82 03-Jan-2024 15:31 7 KB bartgo to previous
81 03-Jan-2024 15:13 7 KB bartgo to previous | to last

Page References

Incoming links Outgoing links

Version management

Difference between version and

At line 6 changed 16 lines
Stack-based languages simplify the interpreter's parser considerably, because the data for an instruction always appears in the source code before the instructions that will use it. To see why this helps, consider this typical line of [BASIC]:
A = 10 + 20 * B
To perform this line, the interpreter has to read the entire line, look up the value of B (let's say 30), realize that the * has to be performed before +, and then finally convert those into instructions something like:
get(B,temp1)
mul(20,temp1, temp2)
add(10,temp2, temp3)
put(temp3,A)
In contrast, in a stack-based system, the programmer organizes the code in the fashion it will ultimately be performed. The equivalent would be:
B 20 mul
10 add
Stack-based languages simplify the interpreter's parser considerably because the data for an instruction always appears in the source code before the instructions that will use it. To see why this helps, consider this typical line of [BASIC]:\\
\\
A = 10 + 20 * B\\
\\
To perform this line, the interpreter has to read the entire line, look up the value of B (let's say 30), realize that the * has to be performed before +, and then finally convert those into instructions something like:\\
\\
get(B,temp1)\\
mul(20,temp1,temp2)\\
add(10,temp2,temp3)\\
put(temp3,A)\\
\\
In contrast, in a stack-based system, the programmer organizes the code in the fashion it will ultimately be performed. The equivalent would be:\\
\\
B 20 mul\\
10 add\\
\\