Commit Graph

903 Commits

Author SHA1 Message Date
Simon Forman ae77bbda24 Move all the bigints code into own dir. 2023-02-14 08:48:08 -08:00
Simon Forman e771e0182b Make /\ and \/ check that their args are Booleans. 2023-02-14 08:40:32 -08:00
Simon Forman ad0f135376 Don't let defs shadow builtins. 2023-02-14 08:39:52 -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 19890e5695 Minor edits. 2023-02-14 07:56:27 -08:00
Simon Forman ca54198e58 Updating the README a little. 2023-02-14 07:55:58 -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 a828169b34 initialization/1 FTW! 2023-02-12 20:39:26 -08:00
Simon Forman 1540338306 Minor cleanup.
To the first serious Joy code: bigints!
2023-02-12 20:11:40 -08:00
Simon Forman b0d79f77f7 minor refactor 2023-02-12 19:19:51 -08:00
Simon Forman 5bccaff9f2 Conform!
cons and loop check type before number.
Don't print '<- top'.
2023-02-12 18:45:56 -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 4330c26cef Minor cleanup. 2023-02-12 16:00:45 -08:00
Simon Forman 51b32bbc0a Quiet mode for C. 2023-02-12 15:15:01 -08:00
Simon Forman 9a74b91d04 minor cleanup 2023-02-12 08:22:16 -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 035fb00939 minor cleanup 2023-02-09 08:28:31 -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
Simon Forman 94bcd2aa51 Minor cleanup. 2023-02-07 20:47:32 -08:00
Simon Forman efd77a2ffd Aliases can be put in KEYWORDS.in
This avoids the overhead of single-functions definitions for aliases.
2023-02-07 19:14:37 -08:00
Simon Forman 0c8e49d591 dispatch 2023-02-07 17:44:32 -08:00
Simon Forman b57cfdf825 Track KEYWORDS.txt after all. 2023-02-06 13:14:14 -08:00
Simon Forman 708e5ad3f5 eq, neq, gt, ge, lt, le 2023-02-06 13:09:37 -08:00
Simon Forman 05575d8a08 A bunch of definitions.
Still to do: the comparison functions.
2023-02-06 12:59:39 -08:00
Simon Forman 437e0af91d Use setjmp/longjmp to recover after errors.
Wow!  That was easy!
2023-02-06 00:30:25 -08:00
Simon Forman 0611aa3c05 Clean KEYWORDS.txt too. 2023-02-05 20:48:19 -08:00
Simon Forman 5b12385253 pop_list <=> pop_list_node
These names seem like they should be swapped.
2023-02-05 19:47:32 -08:00
Simon Forman b70231bcff minor cleanup 2023-02-05 19:40:16 -08:00
Simon Forman 3a11fcb834 loop
But it's pretty inefficient, eh?
2023-02-05 18:43:05 -08:00
Simon Forman 26a733f720 first, rest 2023-02-05 17:40:26 -08:00
Simon Forman d3a9a6ff7f A README file. 2023-02-05 14:54:33 -08:00
Simon Forman ccbf8d2b4c minor cleanup 2023-02-05 13:53:53 -08:00
Simon Forman 8bda5d511a Auto-generate defintions from defs.txt
But it doesn't yet handle names with non-C-indentifier characters in
them.
2023-02-05 13:50:16 -08:00
Simon Forman 291b6caa75 Generate definitions.h; swons 2023-02-05 13:38:59 -08:00
Simon Forman 78b59dda35 Put defs into a generated file.
This is only part of the solution, we still need to update joy.h and
KEYWORDS.txt when defs.txt changes, and we need to handle names that
have non-C-identifier characters in them.

But it's a start...
2023-02-05 13:04:31 -08:00
Simon Forman 6eae43c27f push_quote_onto_expression
doesn't push an empty list, unlike push_quote() which does.
2023-02-05 11:58:44 -08:00
Simon Forman a9e4f93cdc concat 2023-02-05 11:00:22 -08:00
Simon Forman 6ee3226a88 swap 2023-02-05 10:27:17 -08:00