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 3 added 2 lines
[{TableOfContents }]
At line 6 changed 5 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:\\
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]:\\
At line 12 changed 4 lines
get(B,temp1)\\
mul(20,temp1,temp2)\\
add(10,temp2,temp3)\\
put(temp3,A)\\
{{A = 10 + 20 * B}}\\
At line 17 changed one line
In contrast, in a stack-based system, the programmer organizes the code in the fashion it will ultimately be performed. The equivalent would be:\\
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 order the instructions correctly, and then finally convert those into instructions something like:\\
\\
{{get(B,temp1)}} - get the value in B and store it in temp1\\
{{multiply(20,temp1,temp2)}} - multiply that value by 20 and store the result in temp2\\
{{add(10,temp2,temp3)}} - add 10 to temp2 and store the result in temp3 \\
{{put(temp3,A)}} - store the value of temp3 into the variable 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 something like:\\
At line 19 changed 2 lines
B 20 mul\\
10 add\\
{{B 20 mul}}\\
{{10 add}}\\
At line 22 changed one line
When this code is performed, the interpreter pushes the value of B on the stack, then 20. It then encounters the mul, which removes the last two items, the 30 and 20, multiplies them, and puts the result back on the stack. Next, it pushes 10 on the stack, and encounters add, taking the two values, adding them, and putting the result back on the stack.
When this code is performed, the interpreter pushes the value of B on the stack, then 20. It then encounters the mul, which removes the last two items, the 30 and 20, multiplies them, and puts the result back on the stack. Next, it pushes 10 on the stack, leaving the top two locations containing 60 and 10. It then encounters add, taking the two values, adding them, and putting the result back on the stack. The top of the stack now contains the result, 70.
At line 24 changed one line
Notice that the stack-based version *has no temporary values*, and only reads a single instruction at a time, not an entire line of code. As a result, the parser is much simpler, smaller and requires less memory to run. This, in turn, generally makes it much faster, comparable to compiled programs.
Notice that the stack-based version ''has no temporary values'', and only reads a single instruction at a time, not an entire line of code. As a result, the parser is much simpler, smaller and requires less memory to run. This, in turn, generally makes it much faster, comparable to compiled programs.
At line 32 removed 2 lines
[{TableOfContents }]
At line 35 removed one line
At line 42 changed one line
!! Tutorials
!! Forth Systems for the Atari
At line 44 changed one line
* [Einfuehrung in Forth 83]
* [FOCO65|https://github.com/piotr-wiszowaty/foco65] a Forth Cross-Compiler written in Python that translates into XASM assembly language
* [SPL] (Simple Programming Language) a Forth-ish compiler written in Python that translates into Assembly language
* [X-FORTH] - a FIG Forth variant, currently maintained
* [VolksForth] - a powerful Forth83 standards Forth for Atari 8bit, Atari ST, MS-DOS, CP/M, C=64, C=16/116/Plus4, still maintained
* [ANTIC Forth]
* [valFORTH]
* [English Software Company FORTH]
** [Page 6 Review of ES Forth|http://page6.org/archive/issue_14/page_34.htm]
* [Extended Atari FIG-Forth APX20029]
* [Mesa Forth]
* [QS Forth]
* [Graphic Forth] - A ANTIC / Fig-FORTH 1.4s Version with special Graphics Extensions.
* [FIG Forth 1.1]
* [FIG Forth 1.0D]
* [fig-FORTH1.4S-1.atr]
* [fig-FORTH1.4S-2.atr]
* [ProForth] Apple II (6502 Source)
* [SNAUT]
* [Forth Compiler from Frank Ostrowski]
At line 73 changed one line
!! Forth Systems for the Atari
!! Tutorials
* [Einfuehrung in Forth 83]
At line 75 removed 20 lines
* [FOCO65|https://github.com/piotr-wiszowaty/foco65] a Forth Cross-Compiler written in Python that translates into XASM assembly language
* [SPL] (Simple Programming Language) a Forth-ish compiler written in Python that translates into Assembly language
* [X-FORTH] - a FIG Forth variant, currently maintained
* [VolksForth] - a powerful Forth83 standards Forth for Atari 8bit, Atari ST, MS-DOS, CP/M, C=64, C=16/116/Plus4, still maintained
* [ANTIC Forth]
* [valFORTH]
* [English Software Company FORTH]
** [Page 6 Review of ES Forth|http://page6.org/archive/issue_14/page_34.htm]
* [Extended Atari FIG-Forth APX20029]
* [Mesa Forth]
* [QS Forth]
* [Graphic Forth] - A ANTIC / Fig-FORTH 1.4s Version with special Graphics Extensions.
* [FIG Forth 1.1]
* [FIG Forth 1.0D]
* [fig-FORTH1.4S-1.atr]
* [fig-FORTH1.4S-2.atr]
* [ProForth] Apple II (6502 Source)
* [SNAUT]
* [Forth Compiler from Frank Ostrowski]
At line 108 removed one line