Commit Graph

920 Commits

Author SHA1 Message Date
Simon Forman aee4365929 Logical Boolean ops in bigints.joy. 2023-02-14 20:31:35 -08:00
Simon Forman db9c2c16a9 inscribe command for Nim.
https://todo.sr.ht/~sforman/thun-der/27

It doesn't let you overwrite definitions that are loaded from defs.txt.
It DOES let you overwrite builtins, but that doesn't matter because they
are handled by joy_eval() before it checks the dictionary, so in
practice the definitions are never evaluated even though they are put
into the dictionary.  Whew!  It's hacky but it works!
2023-02-14 20:27:36 -08:00
Simon Forman 3d78f831cb Emit errors on stderr. 2023-02-14 18:48:49 -08:00
Simon Forman de774af3da Emit error messages on stderr. 2023-02-14 17:57:29 -08:00
Simon Forman db322b0b3b Emit error messages on stderr. 2023-02-14 17:52:52 -08:00
Simon Forman eca5e41cc9 Conform Python error messages. 2023-02-14 17:40:49 -08:00
Simon Forman 2f5f679d61 No negative shift values. 2023-02-14 14:56:46 -08:00
Simon Forman 23cf3f5b70 lshift and rshift for Nim.
Incomplete, should reject negative shift count.
2023-02-14 14:19:57 -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 8c36d8316e Hack to deal with trailing underscores. 2023-02-14 12:08:32 -08:00
Simon Forman 9c355166b6 Bring error message inline with other implementations. 2023-02-14 12:07:58 -08:00
Simon Forman 21ac1f1f63 Ignore some stuff. 2023-02-14 10:26:33 -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 2700ab8a7f Aliases for builtins in Python Joy. 2023-02-14 10:19:03 -08:00
Simon Forman 178e58f8bd Load embedded defs.txt, remove ≡ stuff.
I like that ≡ but I also like consistency.
2023-02-14 10:07:26 -08:00
Simon Forman 25c48e059b Splice defs.txt into joy.py to make "joy" script. 2023-02-14 09:52:01 -08:00
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