Commit Graph

301 Commits

Author SHA1 Message Date
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 7d99bb4e23 SWIProlog 2023-02-18 20:09:19 -08:00
Simon Forman a33bb8cdaa eval_joy_ast 2023-02-17 13:56:37 -08:00
Simon Forman 0d51f7ec1f A simple Joy-to-AST program.
Written in GNU Prolog, doncha know!?  :D
2023-02-17 11:08:43 -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 1256fb47d8 A start on styling notebooks.
I'd like the website to have some consistency.
2023-02-15 13:43:22 -08:00
Simon Forman 610de03e0b Minor updates to README file.
Removed setup.py until Python folks stabilize packaging and
distribution.  Just put the joy script in your PATH, eh?
2023-02-15 10:05:25 -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 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 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 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 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