OSDN Git Service
Simon Forman [Thu, 16 Feb 2023 19:45:54 +0000 (11:45 -0800)]
Minor cleanup. This is pretty nice.
It's hard to believe this datastructure is so obscure!
Simon Forman [Thu, 16 Feb 2023 19:42:17 +0000 (11:42 -0800)]
Double list size each time; neat demo.
Simon Forman [Thu, 16 Feb 2023 19:41:35 +0000 (11:41 -0800)]
Set correct last_used when creating new vlist.
Simon Forman [Thu, 16 Feb 2023 19:27:39 +0000 (11:27 -0800)]
() is the null pointer
Simon Forman [Thu, 16 Feb 2023 18:56:37 +0000 (10:56 -0800)]
A start on VList.
Simon Forman [Thu, 16 Feb 2023 01:22:14 +0000 (17:22 -0800)]
Used "Artistic Style" (astyle) to check formatting.
Simon Forman [Wed, 15 Feb 2023 21:43:22 +0000 (13:43 -0800)]
A start on styling notebooks.
I'd like the website to have some consistency.
Simon Forman [Wed, 15 Feb 2023 18:05:25 +0000 (10:05 -0800)]
Minor updates to README file.
Removed setup.py until Python folks stabilize packaging and
distribution. Just put the joy script in your PATH, eh?
Simon Forman [Wed, 15 Feb 2023 04:31:35 +0000 (20:31 -0800)]
Logical Boolean ops in bigints.joy.
Simon Forman [Wed, 15 Feb 2023 04:27:36 +0000 (20:27 -0800)]
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!
Simon Forman [Wed, 15 Feb 2023 02:48:49 +0000 (18:48 -0800)]
Emit errors on stderr.
Simon Forman [Wed, 15 Feb 2023 01:57:29 +0000 (17:57 -0800)]
Emit error messages on stderr.
Simon Forman [Wed, 15 Feb 2023 01:52:52 +0000 (17:52 -0800)]
Emit error messages on stderr.
Simon Forman [Wed, 15 Feb 2023 01:40:49 +0000 (17:40 -0800)]
Conform Python error messages.
Simon Forman [Tue, 14 Feb 2023 22:56:46 +0000 (14:56 -0800)]
No negative shift values.
Simon Forman [Tue, 14 Feb 2023 22:19:57 +0000 (14:19 -0800)]
lshift and rshift for Nim.
Incomplete, should reject negative shift count.
Simon Forman [Tue, 14 Feb 2023 21:15:53 +0000 (13:15 -0800)]
lshift and rshift for C.
Simon Forman [Tue, 14 Feb 2023 20:27:46 +0000 (12:27 -0800)]
or instead of ||, and instead of &&
Docs still TODO!
Simon Forman [Tue, 14 Feb 2023 20:08:32 +0000 (12:08 -0800)]
Hack to deal with trailing underscores.
Simon Forman [Tue, 14 Feb 2023 20:07:58 +0000 (12:07 -0800)]
Bring error message inline with other implementations.
Simon Forman [Tue, 14 Feb 2023 18:26:33 +0000 (10:26 -0800)]
Ignore some stuff.
Simon Forman [Tue, 14 Feb 2023 18:23:23 +0000 (10:23 -0800)]
Regularize defs.txt.
All three main interpreters use the same defs.txt file.
Simon Forman [Tue, 14 Feb 2023 18:19:03 +0000 (10:19 -0800)]
Aliases for builtins in Python Joy.
Simon Forman [Tue, 14 Feb 2023 18:07:26 +0000 (10:07 -0800)]
Load embedded defs.txt, remove ≡ stuff.
I like that ≡ but I also like consistency.
Simon Forman [Tue, 14 Feb 2023 17:52:01 +0000 (09:52 -0800)]
Splice defs.txt into joy.py to make "joy" script.
Simon Forman [Tue, 14 Feb 2023 16:48:08 +0000 (08:48 -0800)]
Move all the bigints code into own dir.
Simon Forman [Tue, 14 Feb 2023 16:40:32 +0000 (08:40 -0800)]
Make /\ and \/ check that their args are Booleans.
Simon Forman [Tue, 14 Feb 2023 16:39:52 +0000 (08:39 -0800)]
Don't let defs shadow builtins.
Simon Forman [Tue, 14 Feb 2023 16:27:17 +0000 (08:27 -0800)]
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
Simon Forman [Tue, 14 Feb 2023 15:56:52 +0000 (07:56 -0800)]
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?
Simon Forman [Tue, 14 Feb 2023 15:56:27 +0000 (07:56 -0800)]
Minor edits.
Simon Forman [Tue, 14 Feb 2023 15:55:58 +0000 (07:55 -0800)]
Updating the README a little.
Simon Forman [Tue, 14 Feb 2023 15:55:09 +0000 (07:55 -0800)]
Unify the various defs.txt files...
Work in progress. THis is broken now.
Simon Forman [Mon, 13 Feb 2023 04:39:26 +0000 (20:39 -0800)]
initialization/1 FTW!
Simon Forman [Mon, 13 Feb 2023 04:11:40 +0000 (20:11 -0800)]
Minor cleanup.
To the first serious Joy code: bigints!
Simon Forman [Mon, 13 Feb 2023 03:19:51 +0000 (19:19 -0800)]
minor refactor
Simon Forman [Mon, 13 Feb 2023 02:45:56 +0000 (18:45 -0800)]
Conform!
cons and loop check type before number.
Don't print '<- top'.
Simon Forman [Mon, 13 Feb 2023 00:17:27 +0000 (16:17 -0800)]
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.
Simon Forman [Mon, 13 Feb 2023 00:04:37 +0000 (16:04 -0800)]
fdiv
This is why you compile and run tests /before/ you commit changes, eh?
Simon Forman [Mon, 13 Feb 2023 00:01:19 +0000 (16:01 -0800)]
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
Simon Forman [Mon, 13 Feb 2023 00:00:45 +0000 (16:00 -0800)]
Minor cleanup.
Simon Forman [Sun, 12 Feb 2023 23:15:01 +0000 (15:15 -0800)]
Quiet mode for C.
Simon Forman [Sun, 12 Feb 2023 16:22:16 +0000 (08:22 -0800)]
minor cleanup
Simon Forman [Fri, 10 Feb 2023 16:10:47 +0000 (08:10 -0800)]
Build manifest for sr.ht.
Simon Forman [Fri, 10 Feb 2023 16:09:31 +0000 (08:09 -0800)]
minor cleanup
Simon Forman [Thu, 9 Feb 2023 18:58:08 +0000 (10:58 -0800)]
null, small
https://todo.sr.ht/~sforman/thun-der/23
Simon Forman [Thu, 9 Feb 2023 16:28:31 +0000 (08:28 -0800)]
minor cleanup
Simon Forman [Thu, 9 Feb 2023 15:52:50 +0000 (07:52 -0800)]
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.
Simon Forman [Thu, 9 Feb 2023 14:59:39 +0000 (06:59 -0800)]
divmod, xor
Simon Forman [Thu, 9 Feb 2023 07:20:35 +0000 (23:20 -0800)]
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.
Simon Forman [Thu, 9 Feb 2023 05:13:23 +0000 (21:13 -0800)]
User definitions with the inscribe command.
Using uthash http://troydhanson.github.io/uthash/index.html
Simon Forman [Wed, 8 Feb 2023 23:06:12 +0000 (15:06 -0800)]
unstack
Simon Forman [Wed, 8 Feb 2023 20:50:23 +0000 (12:50 -0800)]
Handle definitions with non-alphanumeric chars in their names.
Simon Forman [Wed, 8 Feb 2023 19:55:33 +0000 (11:55 -0800)]
Oh, LDFLAGS, right...
Simon Forman [Wed, 8 Feb 2023 04:53:44 +0000 (20:53 -0800)]
Initializers for Boolean values.
Simon Forman [Wed, 8 Feb 2023 04:47:32 +0000 (20:47 -0800)]
Minor cleanup.
Simon Forman [Wed, 8 Feb 2023 03:14:37 +0000 (19:14 -0800)]
Aliases can be put in KEYWORDS.in
This avoids the overhead of single-functions definitions for aliases.
Simon Forman [Wed, 8 Feb 2023 01:44:32 +0000 (17:44 -0800)]
dispatch
Simon Forman [Mon, 6 Feb 2023 21:14:14 +0000 (13:14 -0800)]
Track KEYWORDS.txt after all.
Simon Forman [Mon, 6 Feb 2023 21:09:37 +0000 (13:09 -0800)]
eq, neq, gt, ge, lt, le
Simon Forman [Mon, 6 Feb 2023 20:59:39 +0000 (12:59 -0800)]
A bunch of definitions.
Still to do: the comparison functions.
Simon Forman [Mon, 6 Feb 2023 08:30:25 +0000 (00:30 -0800)]
Use setjmp/longjmp to recover after errors.
Wow! That was easy!
Simon Forman [Mon, 6 Feb 2023 04:48:19 +0000 (20:48 -0800)]
Clean KEYWORDS.txt too.
Simon Forman [Mon, 6 Feb 2023 03:47:32 +0000 (19:47 -0800)]
pop_list <=> pop_list_node
These names seem like they should be swapped.
Simon Forman [Mon, 6 Feb 2023 03:40:16 +0000 (19:40 -0800)]
minor cleanup
Simon Forman [Mon, 6 Feb 2023 02:43:05 +0000 (18:43 -0800)]
loop
But it's pretty inefficient, eh?
Simon Forman [Mon, 6 Feb 2023 01:40:26 +0000 (17:40 -0800)]
first, rest
Simon Forman [Sun, 5 Feb 2023 22:54:33 +0000 (14:54 -0800)]
A README file.
Simon Forman [Sun, 5 Feb 2023 21:53:53 +0000 (13:53 -0800)]
minor cleanup
Simon Forman [Sun, 5 Feb 2023 21:50:16 +0000 (13:50 -0800)]
Auto-generate defintions from defs.txt
But it doesn't yet handle names with non-C-indentifier characters in
them.
Simon Forman [Sun, 5 Feb 2023 21:38:59 +0000 (13:38 -0800)]
Generate definitions.h; swons
Simon Forman [Sun, 5 Feb 2023 21:04:31 +0000 (13:04 -0800)]
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...
Simon Forman [Sun, 5 Feb 2023 19:58:44 +0000 (11:58 -0800)]
push_quote_onto_expression
doesn't push an empty list, unlike push_quote() which does.
Simon Forman [Sun, 5 Feb 2023 19:00:22 +0000 (11:00 -0800)]
concat
Simon Forman [Sun, 5 Feb 2023 18:27:17 +0000 (10:27 -0800)]
swap
Simon Forman [Sun, 5 Feb 2023 18:23:50 +0000 (10:23 -0800)]
forgot to save
Simon Forman [Sun, 5 Feb 2023 18:05:20 +0000 (10:05 -0800)]
No clear def.
Simon Forman [Sun, 5 Feb 2023 18:04:20 +0000 (10:04 -0800)]
Remove def of clear.
It's a neat example of a custom implementation being more efficient than
the Joy code.
Simon Forman [Sun, 5 Feb 2023 18:00:18 +0000 (10:00 -0800)]
stack
Simon Forman [Sun, 5 Feb 2023 17:54:52 +0000 (09:54 -0800)]
swaack
Simon Forman [Sun, 5 Feb 2023 17:50:41 +0000 (09:50 -0800)]
pop
Simon Forman [Sun, 5 Feb 2023 17:40:47 +0000 (09:40 -0800)]
cons
Simon Forman [Sun, 5 Feb 2023 16:49:05 +0000 (08:49 -0800)]
dip
Simon Forman [Sun, 5 Feb 2023 16:38:15 +0000 (08:38 -0800)]
minor cleanup
Simon Forman [Sun, 5 Feb 2023 16:37:13 +0000 (08:37 -0800)]
dup
Simon Forman [Sun, 5 Feb 2023 16:12:32 +0000 (08:12 -0800)]
minor cleanup
Simon Forman [Sun, 5 Feb 2023 07:45:13 +0000 (23:45 -0800)]
truthy
Simon Forman [Sun, 5 Feb 2023 07:08:39 +0000 (23:08 -0800)]
Definitions.
There are things to like about this implementation and things to
dislike.
Things to like:
- It works.
- The defs are baked into the wordlist.
Cons:
- The def bodies are built at start time by parsing strings. it would
be nice to somehow generate initializer literals if possible. But
would that mess up the garbage collector?
- It requires manual labor to update the defs when defs.txt changes. It
would be nice to have a solution that *make* can use.
Simon Forman [Sun, 5 Feb 2023 06:58:38 +0000 (22:58 -0800)]
A first attempt at definitions.
Simon Forman [Sun, 5 Feb 2023 06:58:16 +0000 (22:58 -0800)]
Almost truthy...
Simon Forman [Sun, 5 Feb 2023 03:34:38 +0000 (19:34 -0800)]
div and mod
Simon Forman [Sun, 5 Feb 2023 03:21:13 +0000 (19:21 -0800)]
clear
Simon Forman [Sun, 5 Feb 2023 03:19:48 +0000 (19:19 -0800)]
branch combinator.
Simon Forman [Sun, 5 Feb 2023 03:05:26 +0000 (19:05 -0800)]
i combinator.
Simon Forman [Sun, 5 Feb 2023 02:59:59 +0000 (18:59 -0800)]
Depend on joy.h.
Simon Forman [Sun, 5 Feb 2023 02:51:58 +0000 (18:51 -0800)]
Minor cleanup, print_stack.
Simon Forman [Sat, 4 Feb 2023 21:46:29 +0000 (13:46 -0800)]
Minor cleanup.
Simon Forman [Sat, 4 Feb 2023 21:38:28 +0000 (13:38 -0800)]
Expression is a list-of-lists now.
That way we don't have to concatinate quotes onto it all the time.
Instead we amortize in the next_term() function.
Simon Forman [Sat, 4 Feb 2023 20:47:45 +0000 (12:47 -0800)]
Cmp, comes with GMP.
Simon Forman [Sat, 4 Feb 2023 19:27:03 +0000 (11:27 -0800)]
Boolean singleton values.