Commit Graph

145 Commits

Author SHA1 Message Date
Simon Forman d44c33f397 Update defs. 2024-04-01 16:24:18 -07:00
sforman bca39860f9 Better definition for enstacken. 2023-11-12 09:59:02 -08:00
sforman 735ee73515 Remake C version. 2023-10-23 22:50:44 -07:00
sforman 506b40bba4 min and max 2023-10-09 13:04:16 -07:00
sforman 787dc6a7b3 Nerd Sniped 2023-10-09 11:44:13 -07:00
sforman 16cc0e5769 Change definition of uncons. 2023-09-18 11:26:50 -07:00
sforman e956e177f6 Rebuilt C. 2023-08-30 19:57:57 -07:00
sforman a107e1df6c Rebuilt C interpreter. 2023-08-21 09:53:24 -07:00
sforman 5585ae5d31 _isnt_bool _isnt_two_bools
These probably won't last?
2023-08-02 09:06:11 -07:00
sforman 975924f632 minor edits 2023-07-25 20:03:11 -07:00
sforman a34a2b1aab Compile on Ubuntu. 2023-07-24 11:29:39 -07:00
Simon Forman 7485383d9f Allocate a buffer just large enough.
I figure that's worth the overhead of iterating twice.  It's happening
during a user interaction so there's plenty of time, eh?
2023-02-20 16:23:41 -08:00
Simon Forman eeb935fa07 Break up completion into simple and prefixed cases. 2023-02-20 16:04:12 -08:00
Simon Forman c0b582567a Handle completion of symbols with a prefix...
You can type stuff and then tab and it will work.  Before it would try
to complete the whole line, which didn't work.
2023-02-20 15:48:59 -08:00
Simon Forman 2d3c17c152 Linenoise with rax. 2023-02-20 12:53:58 -08:00
Simon Forman 7d93262c81 Let's use rax to generate tab completions? 2023-02-20 11:19:27 -08:00
Simon Forman b32a3f2496 Line editing with linenoise.
https://github.com/antirez/linenoise
https://todo.sr.ht/~sforman/thun-der/33
2023-02-20 10:20:40 -08:00
Simon Forman d8263e0527 Move and rename push_thing_onto_expression(). 2023-02-20 08:35:03 -08:00
Simon Forman d0a43bea52 Minor cleanup. 2023-02-20 06:38:18 -08:00
Simon Forman 83f393a176 typedef FTW 2023-02-19 20:06:07 -08:00
Simon Forman c35396cf73 Wrap it? 2023-02-19 19:43:53 -08:00
Simon Forman 98e3e91345 I figured out how to spell it. 2023-02-19 19:41:11 -08:00
Simon Forman 5258f4d894 A little macro. 2023-02-19 19:40:43 -08:00
Simon Forman f06c261e81 Let's use the idiomatic functions, eh?
That way the code is simpler and there aren't error messages scattered
all over the place.
2023-02-19 17:54:34 -08:00
Simon Forman f194df8159 How would you compile this?
fn [+] step
2023-02-19 17:43:18 -08:00
Simon Forman efbca82064 vlist.c 2023-02-17 11:07:32 -08:00
Simon Forman 10edbd0ee0 Used "Artistic Style" (astyle) to check formatting. 2023-02-15 17:22:14 -08:00
Simon Forman db322b0b3b Emit error messages on stderr. 2023-02-14 17:52:52 -08:00
Simon Forman c2eae95bb2 lshift and rshift for C. 2023-02-14 13:15:53 -08:00
Simon Forman f1db810370 or instead of ||, and instead of &&
Docs still TODO!
2023-02-14 12:27:46 -08:00
Simon Forman 9c355166b6 Bring error message inline with other implementations. 2023-02-14 12:07:58 -08:00
Simon Forman 5ce30d41c3 Regularize defs.txt.
All three main interpreters use the same defs.txt file.
2023-02-14 10:23:23 -08:00
Simon Forman f0c94aeed8 regularize defs.txt; new andies.
I made a crude facility in the C impl for excluding definitions that
would replace built-in commands.  This should be improved, eh?

I also started on renameing the logical Boolean ops
https://todo.sr.ht/~sforman/thun-der/29
2023-02-14 08:27:17 -08:00
Simon Forman f37ef42cb4 Note to self...
This bit of code works, but I'm not sure why, or even if it's just an
illusion of working, and here lurks a nasty bug?
2023-02-14 07:56:52 -08:00
Simon Forman e35ecea25e Unify the various defs.txt files...
Work in progress.  THis is broken now.
2023-02-14 07:55:09 -08:00
Simon Forman aacd9764fe Make Python and C interpreters conform.
The Python one still checks number before type with get_n_items().
I can live with that for now.
2023-02-12 16:17:27 -08:00
Simon Forman eb38a7e817 fdiv
This is why you compile and run tests /before/ you commit changes, eh?
2023-02-12 16:04:37 -08:00
Simon Forman b6d4175a78 Bring behaviour inline with joytest.
Pop has it's own error message.

Div should be "floor" division

> fdiv rounds q down towards -infinity, and r will have the same sign as
> d. The f stands for “floor”.

https://gmplib.org/manual/Integer-Division
2023-02-12 16:01:19 -08:00
Simon Forman 51b32bbc0a Quiet mode for C. 2023-02-12 15:15:01 -08:00
Simon Forman 6f3b942ded Build manifest for sr.ht. 2023-02-10 08:10:47 -08:00
Simon Forman 75591f36ba minor cleanup 2023-02-10 08:09:31 -08:00
Simon Forman acfa19239e null, small
https://todo.sr.ht/~sforman/thun-der/23
2023-02-09 10:58:08 -08:00
Simon Forman 101a0241d3 and, or (Boolean ops).
"not not" serves as a kind of type-checking identity function. "not"
will error out on non-Boolean values, or the absence of a second arg.
2023-02-09 07:52:50 -08:00
Simon Forman 66f47f8e36 divmod, xor 2023-02-09 06:59:39 -08:00
Simon Forman 8016fd697a Allow for redefinition of user defs.
And some protection for inscribe, empty quotes or quotes that do not
have a symbol at the first item are just consumed without affecting the
user defs.

Because the Gperf wordlist is checked before the user defs hash the
inscribe command cannot overwrite the commands defined in the wordlist.
2023-02-08 23:20:35 -08:00
Simon Forman 35d8ed498f User definitions with the inscribe command.
Using uthash http://troydhanson.github.io/uthash/index.html
2023-02-08 21:13:23 -08:00
Simon Forman b1d7a34eab unstack 2023-02-08 15:06:12 -08:00
Simon Forman 2be2d00e6b Handle definitions with non-alphanumeric chars in their names. 2023-02-08 12:50:23 -08:00
Simon Forman 832cbe34e4 Oh, LDFLAGS, right... 2023-02-08 11:55:33 -08:00
Simon Forman 2b54c0bc0a Initializers for Boolean values. 2023-02-07 20:53:44 -08:00