Commit Graph

184 Commits

Author SHA1 Message Date
Jeremiah Orians 23b12e0ef9
Fixed lisp's behavior when there is insufficient memory 2017-06-24 11:49:28 -04:00
Jeremiah Orians 4963fcfebc
Implemented graceful FAILURE and PRINT 2017-06-24 10:06:50 -04:00
Jeremiah Orians a51c243088
Implementing LSHIFT and RSHIFT per request 2017-06-24 08:49:08 -04:00
Jeremiah Orians 37b061defc
Ensure changelog, checksums and whitespacing rules are updated and enforced 2017-06-24 08:14:31 -04:00
Caleb Ristvedt 1a6c7d5afe
Fix CREATE, implement DOES>, more words
Implemented some new words in forth.s:
* 'DODOES
  Gives the address of the assembly for DODOES. Used by DOES> when compiling
  machine code to jump to it and activate the following high-level forth
  code. This is how non-primitive actions for a word can be set.
* LATEST!
  Sets the LATEST pointer. For when the user wants to write their own way of
  extending the dictionary (word lists, vocabularies, etc).
* R@
  Copies the top of the return stack to the data stack. Useful for when loops
  start getting non-trivial and you start wondering of all those ROTs aren't
  efficient enough. Maybe someday we'll implement a register-allocating
  compiler. Probably not. Too complicated for bootstrapping.
* Not really words but used: DODOES and DOVAR.
  DOVAR is the default behavior of CREATEd words - it just pushes a pointer to
  whatever was allotted right after the word was created. DODOES is jumped to in
  order to invoke high-level forth behaviors for words.
* Changed behavior of CREATE to better match the way it usually works.

Added some words to inital_library.fs (we should fix that name sometime):
* Added a variable BASE to control what base numbers are printed in.
* Turns out I misunderstood what WORD did and mis-diagnosed an early problem in
  ' - so it turns out that nothing was being allotted in the dictionary, just
  stuff in "string space", which if I understand properly just sort of fills up
  infinitely as long as WORD is being invoked. Some other forths try to solve
  this by introducing an input buffer for the current line, at the cost of some
  complexity (as words like [CHAR] and S" have to take that into
  account). Anyway, the HERE and DP! are gone from ' now.
* Added BOUNDS for common setup for sequence-iterating loops.
* Added region-comment "(" (note that it doesn't nest), used most often for
  stack comments.
* Added hex dump printer DUMP and support words, number of bytes printed per
  line is controlled by LINE-SIZE. It looks pretty nice, much of the design is
  based off of gforth's.
* Added DOES> and supporting words, and used it to make VARIABLE, CONSTANT, and
  DEFER.
* Added TUCK, MIN, SPACES, :NONAME, FILL, and <>.

Add LSHIFT and RSHIFT to the wishlist, as ghetto shifting with division seems to
behave a bit strangely when given negative values.

Also, we're now advanced enough to support the tictactoe I wrote awhile back for
gforth! http://paste.lisp.org/display/349394
2017-06-24 07:40:22 -04:00
Jeremiah Orians 800c867085
Altered EXECUTE into indirection 2017-06-17 22:27:15 -04:00
Jeremiah Orians 3b05f83e6a
Fixed the Carriage return issue and CMOVE zeroing issue 2017-06-17 22:05:33 -04:00
Jeremiah Orians b3eedb60de
Refining FORTH to enable more productive development 2017-06-17 00:02:33 -04:00
Jeremiah Orians 97a145ac1f
Enabled support for HIDDEN Flag 2017-06-16 18:08:33 -04:00
Jeremiah Orians c43171c7d2
Added requested ABORT function to forth 2017-06-16 17:43:57 -04:00
Jeremiah Orians 8b0384b370
Added an EXECUTE command primitive to stage2 forth 2017-06-16 16:36:03 -04:00
Jeremiah Orians 77795c669c
Fixed Forth's Stack Leak 2017-06-16 16:19:45 -04:00
Jeremiah Orians 9e2d807553
Fixed the arithmetic order issue found by reepca 2017-06-15 16:36:05 -04:00
Jeremiah Orians 41d3ebb643
Fixing forth comparisons thanks to reepca 2017-06-15 06:33:45 -04:00
Jeremiah Orians 54f4019767
Incorporated requested function into stage2 forth 2017-06-14 23:07:50 -04:00
Jeremiah Orians 2a12799d82
Fixings remaining stack offset bugs 2017-06-14 21:25:41 -04:00
Jeremiah Orians 02b2d231a6
Bug fix thanks to reepca 2017-06-14 21:13:52 -04:00
Jeremiah Orians a37d738138
Wrapup work following new function implementation 2017-05-30 23:02:04 -04:00
Jeremiah Orians 31a9a10d8d
Added essential string comparison primitive. 2017-05-30 22:51:12 -04:00
Jeremiah Orians f28b86d697
Implemented NULL? into stage2 lisp and adjusted accordingly 2017-05-29 22:36:22 -04:00
Jeremiah Orians 9bf8255849
Fixing assoc in mixed lexical scope 2017-05-21 21:13:04 -04:00
Jeremiah Orians c800c14988
Import High Level improvement for stage2 lisp 2017-05-20 14:01:46 -04:00
Jeremiah Orians 5f78bfdf0b
Fixed Let Expressions 2017-05-20 13:49:19 -04:00
Jeremiah Orians a8360e1b4f
Converted stage2 lisp to Lexical scope and added Let expressions 2017-05-14 12:25:34 -04:00
Jeremiah Orians fd70c64f07
Enhanced High Level Lisp prototype with Lexical scope and Let Expressions 2017-05-14 12:21:31 -04:00
Jeremiah Orians 0520fcb23c
Compacting garbage collected lisp rollup 2017-05-06 21:44:05 -04:00
Jeremiah Orians 1b3e5ca5c6
Finished implementing Cell compaction and basic regression
testing (moderate performance improvement)
2017-05-06 21:34:47 -04:00
Jeremiah Orians f7810bbf80
Order Free Cells from Lowest to highest address (minor performance boost) 2017-05-06 12:40:25 -04:00
Jeremiah Orians 8534be74a5
Made minimium changes required to only mark/sweep the cells that have
been allocated. (small speedup)
2017-05-06 10:28:06 -04:00
Jeremiah Orians adaa132b63
Incorporated write command from High Level Lisp into assembly lisp. Now we can use it as a compiler too 2017-04-08 23:26:30 -04:00
Jeremiah Orians fc6b86468b
Enhanced stage2 lisp High level prototype to include line comments and write command 2017-04-08 22:49:04 -04:00
Jeremiah Orians 87477db7eb
Added requested Copyright notices 2017-04-01 17:26:44 -04:00
Jeremiah Orians f7369d7a1e
Finishing up license header compliance 2017-04-01 16:57:20 -04:00
Jeremiah Orians 5f6c7f82bc
Added license to all source files 2017-03-28 20:25:39 -04:00
Jeremiah Orians 8727b3fb1c
Correct for the fact you will run out of stack space before you run out of CONS Cells in only 2MB of ram 2017-02-18 15:45:10 -05:00
Jeremiah Orians ec8695a4fc
Prevent accidential of binary, test or debug files 2017-02-18 15:21:45 -05:00
Jeremiah Orians 75f8d5ba13
Fixed the bug in Write_Int that prevented the display of the number Zero 2017-02-18 14:28:16 -05:00
Jeremiah Orians 5c7336b650
Added support for negative number output. However only able to correctly show output from 2147483647 to -2147483647, with the minor exception of 0 2017-02-18 14:22:37 -05:00
Jeremiah Orians fe092614aa
Added support for reading negative numbers 2017-02-18 13:47:34 -05:00
Jeremiah Orians 28de29489b
Corrected missing negative integer support in high level prototype 2017-02-18 13:37:00 -05:00
Jeremiah Orians 5fa6d33d99
Flushed out Prim_Display and added support for ASCII in EVAL + Proper debugging message 2017-02-18 13:28:05 -05:00
Jeremiah Orians f566ce87bd
Added framework for prim_display 2017-02-18 12:23:48 -05:00
Jeremiah Orians 8aa4ddd62a
Accidentially flipped if displaying on NIL or Not NIL 2017-02-18 11:28:56 -05:00
Jeremiah Orians cef9e52356
Finally implemented prim_freecell and am nearly at feature parity with the high level prototype 2017-02-18 11:21:07 -05:00
Jeremiah Orians c53cad461f
Implemented prim_ascii and fixed minor typo 2017-02-17 17:59:02 -05:00
Jeremiah Orians 77214b299a
Implemented prim_listp 2017-02-17 17:14:03 -05:00
Jeremiah Orians 335835787f
Implemented prim_numlt 2017-02-17 16:58:46 -05:00
Jeremiah Orians 8a82bda0e3
Implemented prim_numle function 2017-02-17 16:53:27 -05:00
Jeremiah Orians 81a1dc5425
Added prim_numge and prim_numeq functions 2017-02-17 16:45:29 -05:00
Jeremiah Orians 2a342586f8
Added Prim_numgt 2017-02-17 16:35:25 -05:00
Jeremiah Orians bdac429cc5
Added prim_not 2017-02-17 14:42:35 -05:00
Jeremiah Orians be551d2ad0
Implemented prim_or 2017-02-17 14:29:48 -05:00
Jeremiah Orians 60324a2b5c
Implemented prim_and 2017-02-17 14:21:29 -05:00
Jeremiah Orians 8b25ea6d05
Added early draft of prim_mod 2017-02-17 13:47:15 -05:00
Jeremiah Orians c8fcf9621d
Added prim_div, now the lisp supports Division 2017-02-17 13:37:26 -05:00
Jeremiah Orians 060b3e0002
Implemented Prim_prod, so the lisp now supports (* 1 2 3 ... n) 2017-02-17 13:28:59 -05:00
Jeremiah Orians 9bcc7d85ee
Minor tweak to remove EOF char being displayed at end of TTY interaction 2017-02-17 13:18:25 -05:00
Jeremiah Orians 223dbafa64
Added HALT primitive 2017-02-17 11:58:26 -05:00
Jeremiah Orians 7417e66f3a
Make readline behave more like high level example 2017-02-17 11:37:35 -05:00
Jeremiah Orians 3a8a256475
Minor formatting fix and correction to writeobj 2017-02-17 11:30:24 -05:00
Jeremiah Orians 86d22cb2dc
Fixed bug in write_int 2017-02-17 10:40:11 -05:00
Jeremiah Orians 317354c043
Fixed major bug in assoc 2017-02-17 10:19:10 -05:00
Jeremiah Orians 2de5c17665
Fixing bugs found in lisp_read assembly implementations 2017-02-16 20:23:07 -05:00
Jeremiah Orians a8dd4c265c
Forgot to update a jump 2017-02-16 18:30:39 -05:00
Jeremiah Orians 3462170d90
Attempted to migrate implementation to match high level prototype 2017-02-16 18:27:48 -05:00
Jeremiah Orians 2ac3f8178d
Broke EVAL into smaller chunks to make testing easier 2017-02-16 17:36:12 -05:00
Jeremiah Orians 27e30e8908
Fixed missing top environment from main loop 2017-02-15 23:19:13 -05:00
Jeremiah Orians c198cd87ca
Added logic to notify the user why said HALT occurred 2017-02-12 20:29:32 -05:00
Jeremiah Orians 3909099e49
Fixed multiple bugs in unmark function 2017-02-12 20:28:26 -05:00
Jeremiah Orians 7c351be0d7
Returned Normal ordering for debugging purposes 2017-02-12 20:06:54 -05:00
Jeremiah Orians 933b927f4a
Got CONS Cell garbage collection to run backwards 2017-02-12 17:55:30 -05:00
Jeremiah Orians c3abaad92b
Reorganized Memory Space and fixed output bug with Integers 2017-02-12 17:26:33 -05:00
Jeremiah Orians 6688439ec9
Fixed some minor defects 2017-02-12 02:32:44 -05:00
Jeremiah Orians 04e46c2ad6
Added final pieces from lisp_Cell to begin testing 2017-02-12 01:40:22 -05:00
Jeremiah Orians 2f3cab1158
Added Garbage Collect and POP_CONS. Eliminated the need for garbage_init 2017-02-12 01:22:13 -05:00
Jeremiah Orians 6a9a559c87
Added unmark_cells from lisp_Cell 2017-02-12 01:02:30 -05:00
Jeremiah Orians 8816f05102
Added mark_all_cells from Lisp_Cell 2017-02-12 00:41:22 -05:00
Jeremiah Orians 9ed1913db2
Added reclaim_marked function from lisp_Cell 2017-02-12 00:29:12 -05:00
Jeremiah Orians 6191300576
Started to add garbage collection functions from lisp_Cell 2017-02-12 00:01:27 -05:00
Jeremiah Orians e4143472c3
Added early version of init_sl3 from lisp_Eval 2017-02-11 23:46:42 -05:00
Jeremiah Orians cb1c685a4d
Added spinup from lisp_Eval and several objects 2017-02-11 23:02:42 -05:00
Jeremiah Orians 046375d421
Simplified spinup and garbage collection 2017-02-11 22:40:07 -05:00
Jeremiah Orians 135c068259
Simplified spinup process 2017-02-11 22:29:25 -05:00
Jeremiah Orians 8280407cd6
Added primitive CAR and CDR from Lisp_Eval 2017-02-11 21:24:13 -05:00
Jeremiah Orians 75c75a417a
Skipping multiple functions in Lisp_Eval that can be done later and added a couple essential 2017-02-11 21:17:57 -05:00
Jeremiah Orians de6cf3e7d1
Incorporated enhancement and implemented prim_sub from Lisp_Eval 2017-02-11 19:28:13 -05:00
Jeremiah Orians 175d383ad0
Fixed inconsistent returns from primitives and tweaked order slightly in Lisp_Eval 2017-02-11 19:26:53 -05:00
Jeremiah Orians a7d29173dd
Added prim_sum from Lisp_Eval 2017-02-11 19:01:46 -05:00
Jeremiah Orians ca00a7bd07
Added EVAL from Lisp_Eval 2017-02-11 18:50:18 -05:00
Jeremiah Orians d9feea6fec
Minor tweak on progn 2017-02-11 17:20:15 -05:00
Jeremiah Orians 859b119691
Tweaked ordering for simpler understanding of begin (progn) 2017-02-11 17:14:35 -05:00
Jeremiah Orians 629f0e8058
Removed unneeded duplicate in high level prototype 2017-02-11 17:04:39 -05:00
Jeremiah Orians bee711e94c
Added evcond from Lisp_Eval 2017-02-11 16:25:21 -05:00
Jeremiah Orians d55b9ee5da
Added Apply from Lisp_Eval 2017-02-11 15:29:07 -05:00
Jeremiah Orians 8371cc362b
Added Progn from Lisp_Eval 2017-02-11 14:54:07 -05:00
Jeremiah Orians 5ca2ed530a
Added Evlis from Lisp_Eval 2017-02-11 14:30:25 -05:00
Jeremiah Orians 1061c96c87
Added assoc from Lisp_Eval 2017-02-11 14:12:48 -05:00
Jeremiah Orians 6026474e3a
Added Extend_Top from Lisp_Eval 2017-02-11 13:53:58 -05:00
Jeremiah Orians 8df8e35439
Added Multiple_extend from lisp_eval 2017-02-11 13:38:45 -05:00
Jeremiah Orians 9861dff3f6
Added Extend from Lisp_Eval 2017-02-11 13:17:06 -05:00