Powered by Invision Power Board

 
    Reply to this topicStart new topicStart Poll

> How to make Forth interpreter, I explained how it works
Unspecified
zzo38
Posted: Aug 21 2008, 09:04 PM
Quote Post


Registered user


Group Icon
Group: Members
Posts: 1621
Member No.: 2549
Joined: 21-August 06

Status: (0d) [--]


You can learn how to make Forth interpreter if you want to, it is very simple to make.

I can explain the steps:
  1. Read a word from input stream (ending with any type of white-spaces)
  2. Look it up in dictionary
  3. If is in dictionary, do execute/compile word according to what type it is
  4. If it isn't in dictionary, try to treat it as a number
  5. Do it again for the next word
You can define the primitives, they don't have to be very much. Most things are defined directly in Forth. See my signature for a example of defining IF and THEN command in Forth.

I made in QBASIC: http://zzo38computer.cjb.net/prog/QBFORTH/QBFORTH.ZIP

This post has been edited by zzo38 on Aug 21 2008, 09:05 PM


--------------------
Access my web-site
Vonkeror: the new web-browser
Wikipedia user-page
My gopher site Forget Web 2.0. Now is the time for Gopher 2.0.
Furryscript!!

Member of Anti-Master-Balls

Message to the moderator: I don't want you to add the badges under my name anymore.
PMUsers Website
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

  Topic Options Topic Options Reply to this topicStart new topicStart Poll

 




[ Script Execution time: 0.0288 ]   [ 14 queries used ]   [ GZIP Enabled ]   [ Server Load: 1.83 ]