Removed silly stuff from readme.
[forth.jl.git] / README
1 forth.jl
2 ========
3
4 A hobby implementation of a forth system atop the Julia scientific
5 computing language.  It will almost certainly never be useful for any
6 purpose besides that which it has already fulfilled: forcing me to
7 think quite carefully about how forth works.
8
9 This package owes a massive debt to the existence of the literate
10 programming project JonesForth
11 (https://rwmj.wordpress.com/2010/08/07/jonesforth-git-repository/),
12 which was an amazing read. To a large degree my package is simply a
13 port of that project from x86 assembly + forth to julia + forth,
14 although the mapping is in a few places non-trivial due to the fact
15 that julia is a high level language.  During the bootstrapping
16 process, a huge proportion (say 80%) of the library code in
17 src/lib.4th was directly copied from JonesForth.  (The fact that it
18 was possible to reuse this code was satisfying in its own right!)
19 Since that time I've added a significant number of core definitions
20 and modified some of the others with the eventual aim of F83
21 compliance (discussed below).
22
23 Installation
24 ------------
25
26 forth.jl is not (and probably will never be) a registered julia
27 package.  To install it, you will therefore need to use the following
28 command from the Julia package manager (accessed using the `]` key):
29
30     (v1.8) pkg> add git://thelambdalab.xyz/forth.jl.git
31
32 Be aware that **forth.jl requires Julia 1.8 or later**.
33
34 Usage
35 -----
36
37 To start the interpreter/compiler running, simply enter the following
38 at the julia prompt:
39
40     julia> import forth
41     julia> forth.run()
42
43 The first thing the interpreter will do is compile the core
44 definitions in the library file.  Once this is complete you can start
45 entering forth commands:
46
47     : star 42 emit ;  ok
48     star * ok
49
50 There's an example Mandelbrot Set drawing program included in the
51 examples directory.  To run it, use the `INCLUDE-LIB` word to open the
52 file and compile its definitions:
53
54     include-lib ../examples/mandelbrot.4th
55     Enter 'mandel' to draw the Mandelbrot Set. ok
56     mandel
57                                                                                 *                   
58                                                                                                     
59                                                                            **                       
60                                                                         ********                    
61                                                                        *********                    
62                                                                          *****                      
63                                                           ***     ********************              
64                                                            ****************************** ****      
65                                                           **********************************        
66                                                        ***************************************      
67                                                      ********************************************   
68                                   **    *            *******************************************    
69                                   *************    *********************************************    
70                                ******************  ********************************************     
71                                ******************* ********************************************     
72          **    *     *  *******************************************************************         
73                                ******************* *******************************************      
74                                 *****************  ********************************************     
75                                   *************     ********************************************    
76                                   **    *           ********************************************    
77                                                      ********************************************   
78                                                         **************************************      
79                                                          ***********************************        
80                                                            ****************************** ****      
81                                                            **     ********************              
82                                                                          *****                      
83                                                                         *******                     
84                                                                        *********                    
85                                                                            **                       
86     ok
87
88 (`INCLUDE-LIB` is exactly like INCLUDE, but includes files relative to
89 thte platform-dependent forth.jl src/ directory.) To exit, enter ^D on
90 a blank line or use the `BYE` word.
91
92 FORTH-83 Compliance
93 -------------------
94
95 One of my goals has been to have forth.jl contain as much of the F83
96 required word set
97 (http://forth.sourceforge.net/standard/fst83/fst83-12.htm) as makes
98 sense given the underlying VM. (Actually, my main goal goes a bit
99 beyond this: I want to forth.jl to be, with a couple of exceptions,
100 compatible with the description of forth contained in the second
101 edition of Leo Brodie's book "Starting Forth".)  I'm fairly happy with
102 my progress so far.  Of the 131 required F83 words, only 20 remain
103 unimplemented.  These words fall into two categories: those I may
104 possibly implement at some point, and those that I do not intend to
105 ever implement for reasons of obsolescence or incompatibility with the
106 design of the VM.
107
108 ### F83 Words that may be implemented someday
109
110     # #> #S -TRAILING <#
111
112 These words all have to do with number to string conversion, something
113 I've not been interested in enough yet to get on top of.
114
115 ### F83 Words that won't be implemented
116
117     D+ D< DNEGATE U< UM* UM/MOD BLOCK BUFFER FLUSH
118     SAVE-BUFFERS UPDATE BLK HOLD LOAD FORTH-83
119
120 These words don't make sense to implement.  The double-length integer
121 words are useless because the smallest unit of memory in our VM is a
122 full 64 bit integer.  For the same reason, there's no point in dealing
123 with unsigned values just to gain access to another bit.  The block
124 I/O words don't make sense because we have access to a filesystem via
125 the OS.
126
127 License
128 -------
129
130 This package is free software and is distributed under version 3.0 of
131 the GNU General Public License, which may be found in the file LICENSE
132 in this directory.