OSDN Git Service

joypy/Thun.git
14 months agoSWIProlog vlist
Simon Forman [Sun, 19 Feb 2023 04:09:19 +0000 (20:09 -0800)]
SWIProlog

14 months agoeval_joy_ast
Simon Forman [Fri, 17 Feb 2023 21:56:37 +0000 (13:56 -0800)]
eval_joy_ast

14 months agoA simple Joy-to-AST program.
Simon Forman [Fri, 17 Feb 2023 19:08:43 +0000 (11:08 -0800)]
A simple Joy-to-AST program.

Written in GNU Prolog, doncha know!?  :D

14 months agovlist.c
Simon Forman [Fri, 17 Feb 2023 19:07:32 +0000 (11:07 -0800)]
vlist.c

14 months agoMinor cleanup.
Simon Forman [Fri, 17 Feb 2023 01:45:25 +0000 (17:45 -0800)]
Minor cleanup.

14 months agoMinor cleanup.
Simon Forman [Thu, 16 Feb 2023 21:36:31 +0000 (13:36 -0800)]
Minor cleanup.

14 months agoMinor cleanup.
Simon Forman [Thu, 16 Feb 2023 21:26:11 +0000 (13:26 -0800)]
Minor cleanup.

14 months agopick and length
Simon Forman [Thu, 16 Feb 2023 20:12:42 +0000 (12:12 -0800)]
pick and length

14 months agoMinor cleanup. This is pretty nice.
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!

14 months agoDouble list size each time; neat demo.
Simon Forman [Thu, 16 Feb 2023 19:42:17 +0000 (11:42 -0800)]
Double list size each time; neat demo.

14 months agoSet correct last_used when creating new vlist.
Simon Forman [Thu, 16 Feb 2023 19:41:35 +0000 (11:41 -0800)]
Set correct last_used when creating new vlist.

14 months ago() is the null pointer
Simon Forman [Thu, 16 Feb 2023 19:27:39 +0000 (11:27 -0800)]
() is the null pointer

14 months agoA start on VList.
Simon Forman [Thu, 16 Feb 2023 18:56:37 +0000 (10:56 -0800)]
A start on VList.

14 months agoUsed "Artistic Style" (astyle) to check formatting.
Simon Forman [Thu, 16 Feb 2023 01:22:14 +0000 (17:22 -0800)]
Used "Artistic Style" (astyle) to check formatting.

14 months agoA start on styling notebooks.
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.

14 months agoMinor updates to README file.
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?

14 months agoLogical Boolean ops in bigints.joy.
Simon Forman [Wed, 15 Feb 2023 04:31:35 +0000 (20:31 -0800)]
Logical Boolean ops in bigints.joy.

14 months agoinscribe command for Nim.
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!

14 months agoEmit errors on stderr.
Simon Forman [Wed, 15 Feb 2023 02:48:49 +0000 (18:48 -0800)]
Emit errors on stderr.

14 months agoEmit error messages on stderr.
Simon Forman [Wed, 15 Feb 2023 01:57:29 +0000 (17:57 -0800)]
Emit error messages on stderr.

14 months agoEmit error messages on stderr.
Simon Forman [Wed, 15 Feb 2023 01:52:52 +0000 (17:52 -0800)]
Emit error messages on stderr.

14 months agoConform Python error messages.
Simon Forman [Wed, 15 Feb 2023 01:40:49 +0000 (17:40 -0800)]
Conform Python error messages.

14 months agoNo negative shift values.
Simon Forman [Tue, 14 Feb 2023 22:56:46 +0000 (14:56 -0800)]
No negative shift values.

14 months agolshift and rshift for Nim.
Simon Forman [Tue, 14 Feb 2023 22:19:57 +0000 (14:19 -0800)]
lshift and rshift for Nim.

Incomplete, should reject negative shift count.

14 months agolshift and rshift for C.
Simon Forman [Tue, 14 Feb 2023 21:15:53 +0000 (13:15 -0800)]
lshift and rshift for C.

14 months agoor instead of ||, and instead of &&
Simon Forman [Tue, 14 Feb 2023 20:27:46 +0000 (12:27 -0800)]
or instead of ||, and instead of &&

Docs still TODO!

14 months agoHack to deal with trailing underscores.
Simon Forman [Tue, 14 Feb 2023 20:08:32 +0000 (12:08 -0800)]
Hack to deal with trailing underscores.

14 months agoBring error message inline with other implementations.
Simon Forman [Tue, 14 Feb 2023 20:07:58 +0000 (12:07 -0800)]
Bring error message inline with other implementations.

14 months agoIgnore some stuff.
Simon Forman [Tue, 14 Feb 2023 18:26:33 +0000 (10:26 -0800)]
Ignore some stuff.

14 months agoRegularize defs.txt.
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.

14 months agoAliases for builtins in Python Joy.
Simon Forman [Tue, 14 Feb 2023 18:19:03 +0000 (10:19 -0800)]
Aliases for builtins in Python Joy.

14 months agoLoad embedded defs.txt, remove ≡ stuff.
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.

14 months agoSplice defs.txt into joy.py to make "joy" script.
Simon Forman [Tue, 14 Feb 2023 17:52:01 +0000 (09:52 -0800)]
Splice defs.txt into joy.py to make "joy" script.

14 months agoMove all the bigints code into own dir.
Simon Forman [Tue, 14 Feb 2023 16:48:08 +0000 (08:48 -0800)]
Move all the bigints code into own dir.

14 months agoMake /\ and \/ check that their args are Booleans.
Simon Forman [Tue, 14 Feb 2023 16:40:32 +0000 (08:40 -0800)]
Make /\ and  \/ check that their args are Booleans.

14 months agoDon't let defs shadow builtins.
Simon Forman [Tue, 14 Feb 2023 16:39:52 +0000 (08:39 -0800)]
Don't let defs shadow builtins.

14 months agoregularize defs.txt; new andies.
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

14 months agoNote to self...
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?

14 months agoMinor edits.
Simon Forman [Tue, 14 Feb 2023 15:56:27 +0000 (07:56 -0800)]
Minor edits.

14 months agoUpdating the README a little.
Simon Forman [Tue, 14 Feb 2023 15:55:58 +0000 (07:55 -0800)]
Updating the README a little.

14 months agoUnify the various defs.txt files...
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.

14 months agoinitialization/1 FTW!
Simon Forman [Mon, 13 Feb 2023 04:39:26 +0000 (20:39 -0800)]
initialization/1 FTW!

14 months agoMinor cleanup.
Simon Forman [Mon, 13 Feb 2023 04:11:40 +0000 (20:11 -0800)]
Minor cleanup.

To the first serious Joy code: bigints!

14 months agominor refactor
Simon Forman [Mon, 13 Feb 2023 03:19:51 +0000 (19:19 -0800)]
minor refactor

14 months agoConform!
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'.

14 months agoMake Python and C interpreters conform.
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.

14 months agofdiv
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?

14 months agoBring behaviour inline with joytest.
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

14 months agoMinor cleanup.
Simon Forman [Mon, 13 Feb 2023 00:00:45 +0000 (16:00 -0800)]
Minor cleanup.

14 months agoQuiet mode for C.
Simon Forman [Sun, 12 Feb 2023 23:15:01 +0000 (15:15 -0800)]
Quiet mode for C.

14 months agominor cleanup
Simon Forman [Sun, 12 Feb 2023 16:22:16 +0000 (08:22 -0800)]
minor cleanup

14 months agoBuild manifest for sr.ht.
Simon Forman [Fri, 10 Feb 2023 16:10:47 +0000 (08:10 -0800)]
Build manifest for sr.ht.

14 months agominor cleanup
Simon Forman [Fri, 10 Feb 2023 16:09:31 +0000 (08:09 -0800)]
minor cleanup

14 months agonull, small
Simon Forman [Thu, 9 Feb 2023 18:58:08 +0000 (10:58 -0800)]
null, small

https://todo.sr.ht/~sforman/thun-der/23

14 months agominor cleanup
Simon Forman [Thu, 9 Feb 2023 16:28:31 +0000 (08:28 -0800)]
minor cleanup

14 months agoand, or (Boolean ops). simpler
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.

14 months agodivmod, xor
Simon Forman [Thu, 9 Feb 2023 14:59:39 +0000 (06:59 -0800)]
divmod, xor

14 months agoAllow for redefinition of user defs.
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.

14 months agoUser definitions with the inscribe command.
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

14 months agounstack
Simon Forman [Wed, 8 Feb 2023 23:06:12 +0000 (15:06 -0800)]
unstack

14 months agoHandle definitions with non-alphanumeric chars in their names.
Simon Forman [Wed, 8 Feb 2023 20:50:23 +0000 (12:50 -0800)]
Handle definitions with non-alphanumeric chars in their names.

14 months agoOh, LDFLAGS, right...
Simon Forman [Wed, 8 Feb 2023 19:55:33 +0000 (11:55 -0800)]
Oh, LDFLAGS, right...

14 months agoInitializers for Boolean values.
Simon Forman [Wed, 8 Feb 2023 04:53:44 +0000 (20:53 -0800)]
Initializers for Boolean values.

14 months agoMinor cleanup.
Simon Forman [Wed, 8 Feb 2023 04:47:32 +0000 (20:47 -0800)]
Minor cleanup.

14 months agoAliases can be put in KEYWORDS.in
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.

14 months agodispatch
Simon Forman [Wed, 8 Feb 2023 01:44:32 +0000 (17:44 -0800)]
dispatch

14 months agoTrack KEYWORDS.txt after all.
Simon Forman [Mon, 6 Feb 2023 21:14:14 +0000 (13:14 -0800)]
Track KEYWORDS.txt after all.

14 months agoeq, neq, gt, ge, lt, le
Simon Forman [Mon, 6 Feb 2023 21:09:37 +0000 (13:09 -0800)]
eq, neq, gt, ge, lt, le

14 months agoA bunch of definitions.
Simon Forman [Mon, 6 Feb 2023 20:59:39 +0000 (12:59 -0800)]
A bunch of definitions.

Still to do: the comparison functions.

14 months agoUse setjmp/longjmp to recover after errors.
Simon Forman [Mon, 6 Feb 2023 08:30:25 +0000 (00:30 -0800)]
Use setjmp/longjmp to recover after errors.

Wow!  That was easy!

14 months agoClean KEYWORDS.txt too.
Simon Forman [Mon, 6 Feb 2023 04:48:19 +0000 (20:48 -0800)]
Clean KEYWORDS.txt too.

14 months agopop_list <=> pop_list_node
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.

14 months agominor cleanup
Simon Forman [Mon, 6 Feb 2023 03:40:16 +0000 (19:40 -0800)]
minor cleanup

14 months agoloop
Simon Forman [Mon, 6 Feb 2023 02:43:05 +0000 (18:43 -0800)]
loop

But it's pretty inefficient, eh?

14 months agofirst, rest
Simon Forman [Mon, 6 Feb 2023 01:40:26 +0000 (17:40 -0800)]
first, rest

14 months agoA README file.
Simon Forman [Sun, 5 Feb 2023 22:54:33 +0000 (14:54 -0800)]
A README file.

14 months agominor cleanup
Simon Forman [Sun, 5 Feb 2023 21:53:53 +0000 (13:53 -0800)]
minor cleanup

14 months agoAuto-generate defintions from defs.txt
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.

14 months agoGenerate definitions.h; swons
Simon Forman [Sun, 5 Feb 2023 21:38:59 +0000 (13:38 -0800)]
Generate definitions.h; swons

14 months agoPut defs into a generated file.
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...

14 months agopush_quote_onto_expression
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.

14 months agoconcat
Simon Forman [Sun, 5 Feb 2023 19:00:22 +0000 (11:00 -0800)]
concat

14 months agoswap
Simon Forman [Sun, 5 Feb 2023 18:27:17 +0000 (10:27 -0800)]
swap

14 months agoforgot to save
Simon Forman [Sun, 5 Feb 2023 18:23:50 +0000 (10:23 -0800)]
forgot to save

14 months agoNo clear def.
Simon Forman [Sun, 5 Feb 2023 18:05:20 +0000 (10:05 -0800)]
No clear def.

14 months agoRemove def of clear.
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.

14 months agostack
Simon Forman [Sun, 5 Feb 2023 18:00:18 +0000 (10:00 -0800)]
stack

14 months agoswaack
Simon Forman [Sun, 5 Feb 2023 17:54:52 +0000 (09:54 -0800)]
swaack

14 months agopop
Simon Forman [Sun, 5 Feb 2023 17:50:41 +0000 (09:50 -0800)]
pop

14 months agocons
Simon Forman [Sun, 5 Feb 2023 17:40:47 +0000 (09:40 -0800)]
cons

14 months agodip
Simon Forman [Sun, 5 Feb 2023 16:49:05 +0000 (08:49 -0800)]
dip

14 months agominor cleanup
Simon Forman [Sun, 5 Feb 2023 16:38:15 +0000 (08:38 -0800)]
minor cleanup

14 months agodup
Simon Forman [Sun, 5 Feb 2023 16:37:13 +0000 (08:37 -0800)]
dup

14 months agominor cleanup
Simon Forman [Sun, 5 Feb 2023 16:12:32 +0000 (08:12 -0800)]
minor cleanup

14 months agotruthy
Simon Forman [Sun, 5 Feb 2023 07:45:13 +0000 (23:45 -0800)]
truthy

14 months agoDefinitions.
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.

14 months agoA first attempt at definitions.
Simon Forman [Sun, 5 Feb 2023 06:58:38 +0000 (22:58 -0800)]
A first attempt at definitions.

14 months agoAlmost truthy...
Simon Forman [Sun, 5 Feb 2023 06:58:16 +0000 (22:58 -0800)]
Almost truthy...

14 months agodiv and mod
Simon Forman [Sun, 5 Feb 2023 03:34:38 +0000 (19:34 -0800)]
div and mod

14 months agoclear
Simon Forman [Sun, 5 Feb 2023 03:21:13 +0000 (19:21 -0800)]
clear