From 154518d74e66d8ed281494a9e364a468ecfe39fb Mon Sep 17 00:00:00 2001 From: plugd Date: Fri, 7 Oct 2022 10:47:57 +0200 Subject: [PATCH] Updating for Julia 1.8. --- Manifest.toml | 26 +++++++++ Project.toml | 7 ++- README.md => README | 138 ++++++++++++++++++++++++-------------------- REQUIRE | 2 - 4 files changed, 106 insertions(+), 67 deletions(-) create mode 100644 Manifest.toml rename README.md => README (60%) delete mode 100644 REQUIRE diff --git a/Manifest.toml b/Manifest.toml new file mode 100644 index 0000000..d31ff75 --- /dev/null +++ b/Manifest.toml @@ -0,0 +1,26 @@ +# This file is machine-generated - editing it directly is not advised + +julia_version = "1.8.2" +manifest_format = "2.0" +project_hash = "206f4376ca4fb9378de05ed1a9ca3725b6697123" + +[[deps.Base64]] +uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" + +[[deps.InteractiveUtils]] +deps = ["Markdown"] +uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" + +[[deps.Markdown]] +deps = ["Base64"] +uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" + +[[deps.REPL]] +deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] +uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" + +[[deps.Sockets]] +uuid = "6462fe0b-24de-5631-8697-dd941f90decc" + +[[deps.Unicode]] +uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" diff --git a/Project.toml b/Project.toml index 289a7fb..64e1fea 100644 --- a/Project.toml +++ b/Project.toml @@ -1,4 +1,7 @@ name = "forth" -uuid = "b854209b-e968-4163-975a-3ef17cc01beb" +uuid = "5d94d4ce-a281-4022-9146-f8be3647edb1" authors = ["Tim Vaughan "] -version = "1.0.0" +version = "0.1.0" + +[deps] +REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" diff --git a/README.md b/README similarity index 60% rename from README.md rename to README index 09c124f..3b391bc 100644 --- a/README.md +++ b/README @@ -1,51 +1,58 @@ -# forth.jl - -A hobby implementation of a forth system atop the Julia scientific computing -language. It will almost certainly never be useful for any purpose besides -that which it has already fulfilled: forcing me to think quite carefully about -how forth works. - -This package owes a massive debt to the existence of the literate programming -project [JonesForth](https://rwmj.wordpress.com/2010/08/07/jonesforth-git-repository/), -which was an amazing read. To a large degree my package is simply a port of -that project from x86 assembly + forth to julia + forth, although the mapping -is in a few places non-trivial due to the fact that julia is a high level -language. During the bootstrapping process, a huge proportion (say 80%) of the -library code in src/lib.4th was directly copied from JonesForth. (The fact -that it was possible to reuse this code was satisfying in its own right!) Since -that time I've added a significant number of core definitions and modified some -of the others with the eventual aim of F83 compliance (discussed below). - -There's quite a lot to say about the implementation, especially due to its -high-level grounding, but that will have to wait for another time. - -## Installation - -forth.jl is not (and probably will never be) a registered julia package. To -install it, you will therefore need to use the following command from the -Julia package manager (accessed using the `]` key): - - (v1.0) pkg> add https://github.com/tgvaughan/forth.jl +forth.jl +======== + +A hobby implementation of a forth system atop the Julia scientific +computing language. It will almost certainly never be useful for any +purpose besides that which it has already fulfilled: forcing me to +think quite carefully about how forth works. + +This package owes a massive debt to the existence of the literate +programming project JonesForth +(https://rwmj.wordpress.com/2010/08/07/jonesforth-git-repository/), +which was an amazing read. To a large degree my package is simply a +port of that project from x86 assembly + forth to julia + forth, +although the mapping is in a few places non-trivial due to the fact +that julia is a high level language. During the bootstrapping +process, a huge proportion (say 80%) of the library code in +src/lib.4th was directly copied from JonesForth. (The fact that it +was possible to reuse this code was satisfying in its own right!) +Since that time I've added a significant number of core definitions +and modified some of the others with the eventual aim of F83 +compliance (discussed below). + +There's quite a lot to say about the implementation, especially due to +its high-level grounding, but that will have to wait for another time. + +Installation +------------ + +forth.jl is not (and probably will never be) a registered julia +package. To install it, you will therefore need to use the following +command from the Julia package manager (accessed using the `]` key): + + (v1.0) pkg> add git://thelambdalab.xyz/forth.jl.git Be aware that **forth.jl requires Julia 1.0**. -## Usage +Usage +----- -To start the interpreter/compiler running, simply enter the following at -the julia prompt: +To start the interpreter/compiler running, simply enter the following +at the julia prompt: julia> import forth julia> forth.run() -The first thing the interpreter will do is compile the core definitions in -the library file. Once this is complete you can start entering forth commands: +The first thing the interpreter will do is compile the core +definitions in the library file. Once this is complete you can start +entering forth commands: : star 42 emit ; ok star * ok -There's an example Mandelbrot Set drawing program included in the examples -directory. To run it, use the `INCLUDE-LIB` word to open the file and compile its -definitions: +There's an example Mandelbrot Set drawing program included in the +examples directory. To run it, use the `INCLUDE-LIB` word to open the +file and compile its definitions: include-lib ../examples/mandelbrot.4th Enter 'mandel' to draw the Mandelbrot Set. ok @@ -81,43 +88,48 @@ definitions: ** ok -(`INCLUDE-LIB` is exactly like INCLUDE, but includes files relative to thte -platform-dependent forth.jl src/ directory.) To exit, enter ^D on a blank line -or use the `BYE` word. - -## FORTH-83 Compliance - -One of my goals has been to have forth.jl contain as much of the -[F83 required word set](http://forth.sourceforge.net/standard/fst83/fst83-12.htm) -as makes sense given the underlying VM. (Actually, my main goal goes a bit -beyond this: I want to forth.jl to be, with a couple of exceptions, compatible -with the description of forth contained in the second edition of Leo Brodie's -book "Starting Forth".) I'm fairly happy with my progress so far. Of the -131 required F83 words, only 20 remain unimplemented. These words fall into -two categories: those I may possibly implement at some point, and those that I -do not intend to ever implement for reasons of obsolescence or incompatibility -with the design of the VM. +(`INCLUDE-LIB` is exactly like INCLUDE, but includes files relative to +thte platform-dependent forth.jl src/ directory.) To exit, enter ^D on +a blank line or use the `BYE` word. + +FORTH-83 Compliance +------------------- + +One of my goals has been to have forth.jl contain as much of the F83 +required word set +(http://forth.sourceforge.net/standard/fst83/fst83-12.htm) as makes +sense given the underlying VM. (Actually, my main goal goes a bit +beyond this: I want to forth.jl to be, with a couple of exceptions, +compatible with the description of forth contained in the second +edition of Leo Brodie's book "Starting Forth".) I'm fairly happy with +my progress so far. Of the 131 required F83 words, only 20 remain +unimplemented. These words fall into two categories: those I may +possibly implement at some point, and those that I do not intend to +ever implement for reasons of obsolescence or incompatibility with the +design of the VM. ### F83 Words that may be implemented someday # #> #S -TRAILING <# -These words all have to do with number to string conversion, something I've -not been interested in enough yet to get on top of. +These words all have to do with number to string conversion, something +I've not been interested in enough yet to get on top of. ### F83 Words that won't be implemented D+ D< DNEGATE U< UM* UM/MOD BLOCK BUFFER FLUSH SAVE-BUFFERS UPDATE BLK HOLD LOAD FORTH-83 -These words don't make sense to implement. The double-length integer words are -useless because the smallest unit of memory in our VM is a full 64 bit -integer. For the same reason, there's no point in dealing with unsigned values -just to gain access to another bit. The block I/O words don't make sense because -we have access to a filesystem via the OS. +These words don't make sense to implement. The double-length integer +words are useless because the smallest unit of memory in our VM is a +full 64 bit integer. For the same reason, there's no point in dealing +with unsigned values just to gain access to another bit. The block +I/O words don't make sense because we have access to a filesystem via +the OS. -## License +License +------- -This package is free software and is distributed under version 3.0 of the GNU -General Public License, which may be found in the file LICENSE in this -directory. +This package is free software and is distributed under version 3.0 of +the GNU General Public License, which may be found in the file LICENSE +in this directory. diff --git a/REQUIRE b/REQUIRE deleted file mode 100644 index 0650e01..0000000 --- a/REQUIRE +++ /dev/null @@ -1,2 +0,0 @@ -julia 0.5 -REPL -- 2.20.1