OSDN Git Service

joypy/Thun.git
21 months agoI had to model it in Python
Simon Forman [Thu, 29 Sep 2022 01:21:13 +0000 (18:21 -0700)]
I had to model it in Python

before writing it in OCaml.

21 months agoImprove compiling of step combinator.
Simon Forman [Thu, 29 Sep 2022 01:18:20 +0000 (18:18 -0700)]
Improve compiling of step combinator.

21 months agoInitial outline for a talk on Joy.
Simon Forman [Thu, 29 Sep 2022 01:16:45 +0000 (18:16 -0700)]
Initial outline for a talk on Joy.

21 months agocoms, swap
Simon Forman [Sun, 25 Sep 2022 04:19:35 +0000 (21:19 -0700)]
coms, swap

21 months agoComparison operations.
Simon Forman [Sun, 25 Sep 2022 04:00:26 +0000 (21:00 -0700)]
Comparison operations.

21 months agobranch, dip, i, loop
Simon Forman [Sun, 25 Sep 2022 03:45:06 +0000 (20:45 -0700)]
branch, dip, i, loop

The core combinators (except fork).

21 months agoMinor cleanup.
Simon Forman [Sun, 25 Sep 2022 02:39:10 +0000 (19:39 -0700)]
Minor cleanup.

21 months agoSimple REPL.
Simon Forman [Sun, 25 Sep 2022 02:33:29 +0000 (19:33 -0700)]
Simple REPL.

Still very crude, and exceptions are not caught, but it works.

21 months agoMinor cleanup.
Simon Forman [Sat, 24 Sep 2022 21:54:07 +0000 (14:54 -0700)]
Minor cleanup.

21 months agoconcat
Simon Forman [Sat, 24 Sep 2022 21:29:03 +0000 (14:29 -0700)]
concat

Ocaml's match is very powerful, respect, but if I want more precise
error messages (that conform to the joytest suite) then the extra
utility functions must be implemented and employed.

After that it's definition loading and the main REPL loop and I think
that's it, eh?

21 months agoautoformat
Simon Forman [Sat, 24 Sep 2022 21:16:44 +0000 (14:16 -0700)]
autoformat

21 months agoclear
Simon Forman [Sat, 24 Sep 2022 21:16:20 +0000 (14:16 -0700)]
clear

21 months agoAutoformat.
Simon Forman [Sat, 24 Sep 2022 20:13:44 +0000 (13:13 -0700)]
Autoformat.

21 months agoEvaluation is working.
Simon Forman [Sat, 24 Sep 2022 20:13:03 +0000 (13:13 -0700)]
Evaluation is working.

It's all downhill from here, like in skiing!

21 months agoEval symbols...
Simon Forman [Sat, 24 Sep 2022 19:54:46 +0000 (12:54 -0700)]
Eval symbols...

21 months agoWorking towards interpretation.
Simon Forman [Sat, 24 Sep 2022 19:44:20 +0000 (12:44 -0700)]
Working towards interpretation.

21 months agoNice and clean.
Simon Forman [Sat, 24 Sep 2022 19:02:00 +0000 (12:02 -0700)]
Nice and clean.

I wonder what Ocaml programmers would think of this code?

21 months agoParser.
Simon Forman [Sat, 24 Sep 2022 18:00:19 +0000 (11:00 -0700)]
Parser.

Mighty battle.

21 months agoOrder is preserved.
Simon Forman [Sat, 24 Sep 2022 16:01:16 +0000 (09:01 -0700)]
Order is preserved.

21 months agoA couple of little comments.
Simon Forman [Sat, 24 Sep 2022 15:59:38 +0000 (08:59 -0700)]
A couple of little comments.

21 months agoParse tokens into joy_list.
Simon Forman [Sat, 24 Sep 2022 15:54:04 +0000 (08:54 -0700)]
Parse tokens into joy_list.

That seemed a lot harder than it should have been...

21 months agoA start of parsing tokens.
Simon Forman [Sat, 24 Sep 2022 02:35:15 +0000 (19:35 -0700)]
A start of parsing tokens.

21 months agoFormatting.
Simon Forman [Sat, 24 Sep 2022 00:47:31 +0000 (17:47 -0700)]
Formatting.

21 months agoI think I got the tokenizer right.
Simon Forman [Sat, 24 Sep 2022 00:31:16 +0000 (17:31 -0700)]
I think I got the tokenizer right.

21 months agoSo that's mutual recursion in Ocaml?
Simon Forman [Fri, 23 Sep 2022 15:59:06 +0000 (08:59 -0700)]
So that's mutual recursion in Ocaml?

I like it.  Just change "let" to "and" and you're good-to-go.

21 months agoIgnoring _build.
Simon Forman [Fri, 23 Sep 2022 15:54:37 +0000 (08:54 -0700)]
Ignoring _build.

21 months agoIgnore _build dirs.
Simon Forman [Fri, 23 Sep 2022 15:53:39 +0000 (08:53 -0700)]
Ignore _build dirs.

21 months agoautoformat
Simon Forman [Fri, 23 Sep 2022 15:38:17 +0000 (08:38 -0700)]
autoformat

21 months agoOcaml FTW!
Simon Forman [Fri, 23 Sep 2022 15:37:04 +0000 (08:37 -0700)]
Ocaml FTW!

21 months agoAt this point...
Simon Forman [Fri, 23 Sep 2022 03:43:25 +0000 (20:43 -0700)]
At this point...

...I'm just relearning C semantics.  (And they are garbage, as is widely
known.)

I don't think there's much point to this (at the moment) because I don't
want to relearn C (at the moment) and Nim is available (at the moment.)

Really, I'm trying to do away with the entire relationship of C et. al.
to the underlying machine.  (For instance, Nim gives you a much nicer
relationship, without the vast distance that, say, Python imposes.)  I
should really look at other compiled languages, like Ocaml or Julia.

21 months agoCreate an int and add ints.
Simon Forman [Fri, 23 Sep 2022 03:08:24 +0000 (20:08 -0700)]
Create an int and add ints.

21 months agoTry using GC_register_finalizer?
Simon Forman [Fri, 23 Sep 2022 02:34:57 +0000 (19:34 -0700)]
Try using GC_register_finalizer?

21 months agoMaybe this is the right thing to do?
Simon Forman [Fri, 23 Sep 2022 02:00:40 +0000 (19:00 -0700)]
Maybe this is the right thing to do?

https://stackoverflow.com/questions/59489221/using-the-gmp-library-with-boehms-garbage-collector

21 months agoWhat would a little C Joy look like?
Simon Forman [Fri, 23 Sep 2022 00:26:28 +0000 (17:26 -0700)]
What would a little C Joy look like?

Let's use GMP for ints and Boehm GC.

21 months agoWait for both results together.
Simon Forman [Thu, 22 Sep 2022 20:20:30 +0000 (13:20 -0700)]
Wait for both results together.

If one causes an error before the other is finished SIGKILL the other
job.  (I do not know if this will kill the sub-tasks if any.  The Python
docs say that with terminate() "descendant processes of the process will
not be terminated – they will simply become orphaned." but it doesn't
say whether that's true with kill().

21 months agoCapture and fwd exceptions in subforks.
Simon Forman [Thu, 22 Sep 2022 18:41:16 +0000 (11:41 -0700)]
Capture and fwd exceptions in subforks.

(Should there be only one subtask?  Do the other quote in the main
proc?)

22 months agoLet's play with more cores.
Simon Forman [Thu, 22 Sep 2022 16:13:11 +0000 (09:13 -0700)]
Let's play with more cores.

22 months agoBasic system, incomplete.
Simon Forman [Wed, 21 Sep 2022 00:56:18 +0000 (17:56 -0700)]
Basic system, incomplete.

Still needs the rest of the core functions and defs.
Could read defs from a file at compile-time?
Integer math?  Boolean ops?  Just type inference and maybe compiling?

22 months agoParse the tokens into a Joy expression.
Simon Forman [Wed, 21 Sep 2022 00:14:41 +0000 (17:14 -0700)]
Parse the tokens into a Joy expression.

22 months agoParser in GNU Prolog.
Simon Forman [Tue, 20 Sep 2022 23:29:35 +0000 (16:29 -0700)]
Parser in GNU Prolog.

Wonky handling of UTF_8 blankspace.

22 months agoThe whole thing is kind of a mess.
Simon Forman [Tue, 20 Sep 2022 21:22:47 +0000 (14:22 -0700)]
The whole thing is kind of a mess.

22 months agoLet simple joy be joy.
Simon Forman [Tue, 20 Sep 2022 18:12:59 +0000 (11:12 -0700)]
Let simple joy be joy.

Still to do: clear away the rest of the old cruft.

22 months agoRemove cruft.
Simon Forman [Tue, 20 Sep 2022 18:12:28 +0000 (11:12 -0700)]
Remove cruft.

22 months agoMinor cleanup.
Simon Forman [Tue, 20 Sep 2022 17:20:58 +0000 (10:20 -0700)]
Minor cleanup.

22 months agoAdd trace word back in.
Simon Forman [Tue, 20 Sep 2022 17:19:45 +0000 (10:19 -0700)]
Add trace word back in.

Remove pretty_print module.

Still to do: update Nim implementation with a trace function. ;)

22 months agoFix typo in hyperlink in README.
Simon Forman [Tue, 20 Sep 2022 02:43:34 +0000 (19:43 -0700)]
Fix typo in hyperlink in README.

22 months agoMinor cleanup.
Simon Forman [Mon, 19 Sep 2022 20:25:09 +0000 (13:25 -0700)]
Minor cleanup.

22 months agoAdd a flowchart for the interpreter.
Simon Forman [Mon, 19 Sep 2022 20:22:31 +0000 (13:22 -0700)]
Add a flowchart for the interpreter.

Using PlantUML.

22 months agoFixed bug in appN
Simon Forman [Sat, 17 Sep 2022 03:49:46 +0000 (20:49 -0700)]
Fixed bug in appN

while updating some Jupyter notebooks with the Joypy kernel.

22 months agoRemove old docs.
Simon Forman [Sat, 17 Sep 2022 00:54:42 +0000 (17:54 -0700)]
Remove old docs.

22 months agoA bit more docs.
Simon Forman [Fri, 16 Sep 2022 19:28:13 +0000 (12:28 -0700)]
A bit more docs.

22 months agoGot back the LI for lower-cased title notebooks.
Simon Forman [Fri, 16 Sep 2022 18:27:00 +0000 (11:27 -0700)]
Got back the LI for lower-cased title notebooks.

Not sure what went wrong there.

22 months agoWhence fun_with_scan and with_sympy?
Simon Forman [Fri, 16 Sep 2022 18:06:30 +0000 (11:06 -0700)]
Whence fun_with_scan and with_sympy?

22 months agoCleaning up docs.
Simon Forman [Fri, 16 Sep 2022 16:03:42 +0000 (09:03 -0700)]
Cleaning up docs.

Kinda...

22 months agoThe (crude) site.
Simon Forman [Fri, 16 Sep 2022 14:36:28 +0000 (07:36 -0700)]
The (crude) site.

It's funny that I'm using nbconvert, markdown, pandoc, tidy, and of
course python, all to make a simple static website...

"There's got to be a better way!"

22 months agoFunction Reference
Simon Forman [Fri, 16 Sep 2022 14:35:11 +0000 (07:35 -0700)]
Function Reference

22 months ago bits and pieces
Simon Forman [Fri, 16 Sep 2022 02:17:56 +0000 (19:17 -0700)]
 bits and pieces

22 months agoRework docs, simpler (no Sphinx.)
Simon Forman [Fri, 16 Sep 2022 01:14:01 +0000 (18:14 -0700)]
Rework docs, simpler (no Sphinx.)

22 months agodelete all the extra notebook conversions
Simon Forman [Fri, 16 Sep 2022 01:11:16 +0000 (18:11 -0700)]
delete all the extra notebook conversions

22 months agoIgnore the Nim joy binary.
Simon Forman [Thu, 15 Sep 2022 16:34:39 +0000 (09:34 -0700)]
Ignore the Nim joy binary.

22 months agoCheck for minus before converting to int.
Simon Forman [Thu, 15 Sep 2022 04:09:20 +0000 (21:09 -0700)]
Check for minus before converting to int.

BigInts converts "-" to 0.  This happens in the parser before you get to
the evaluator.

22 months agoMinor cleanup, subtraction.
Simon Forman [Thu, 15 Sep 2022 04:01:50 +0000 (21:01 -0700)]
Minor cleanup, subtraction.

Testing with the joytest test suite revealed that I had forgotten to
implement subtraction.  This also unconvered a (maybe) bug in the
BigInts package where it converts "-" to zero.

https://git.sr.ht/~sforman/joytest

https://github.com/nim-lang/bigints/issues/116

22 months agoLet simplejoy be joy.
Simon Forman [Thu, 15 Sep 2022 03:15:25 +0000 (20:15 -0700)]
Let simplejoy be joy.

Simple pleasures are the best.

22 months agoRemove old code.
Simon Forman [Thu, 15 Sep 2022 03:14:34 +0000 (20:14 -0700)]
Remove old code.

22 months agoRead defs.txt at compile-time.
Simon Forman [Thu, 15 Sep 2022 03:08:40 +0000 (20:08 -0700)]
Read defs.txt at compile-time.

I'd like to build the dict datastructure at compile-time too but I'm not
going to figure that out tonight.  It's enough that the defs are
embedded in the executable.  (You can see them with the strings utility.)

22 months agobasis complete
Simon Forman [Thu, 15 Sep 2022 01:51:58 +0000 (18:51 -0700)]
basis complete

22 months agodup, first, i, loop
Simon Forman [Wed, 14 Sep 2022 22:48:25 +0000 (15:48 -0700)]
dup, first, i, loop

22 months agodip and cons
Simon Forman [Wed, 14 Sep 2022 22:04:07 +0000 (15:04 -0700)]
dip and cons

22 months agoRewrite expression to use list instead of list node.
Simon Forman [Wed, 14 Sep 2022 21:36:29 +0000 (14:36 -0700)]
Rewrite expression to use list instead of list node.

22 months agoMinor cleanup.
Simon Forman [Wed, 14 Sep 2022 20:31:44 +0000 (13:31 -0700)]
Minor cleanup.

22 months agoReuse as_list().
Simon Forman [Wed, 14 Sep 2022 18:24:56 +0000 (11:24 -0700)]
Reuse as_list().

22 months agoCleaning up the code.
Simon Forman [Wed, 14 Sep 2022 17:49:13 +0000 (10:49 -0700)]
Cleaning up the code.

22 months agoNimpretty reformat. Two-space indentation.
Simon Forman [Wed, 14 Sep 2022 16:49:33 +0000 (09:49 -0700)]
Nimpretty reformat.  Two-space indentation.

22 months agoMinor cleanup
Simon Forman [Wed, 14 Sep 2022 16:46:31 +0000 (09:46 -0700)]
Minor cleanup

22 months agoLet's pile Nim code into one file too, why not?
Simon Forman [Wed, 14 Sep 2022 16:45:34 +0000 (09:45 -0700)]
Let's pile Nim code into one file too, why not?

22 months agodivmod
Simon Forman [Mon, 12 Sep 2022 23:38:14 +0000 (16:38 -0700)]
divmod

We don't need floor if we have only ints.

Id is too easy as a definition.

divmod is cool.

22 months agostep, times
Simon Forman [Mon, 12 Sep 2022 23:07:21 +0000 (16:07 -0700)]
step, times

22 months agodipd, dipdd, cmp
Simon Forman [Mon, 12 Sep 2022 22:17:32 +0000 (15:17 -0700)]
dipd, dipdd, cmp

22 months agocond
Simon Forman [Mon, 12 Sep 2022 20:50:40 +0000 (13:50 -0700)]
cond

22 months agoupdated defs via make
Simon Forman [Mon, 12 Sep 2022 20:50:07 +0000 (13:50 -0700)]
updated defs via make

22 months agodunno what that was
Simon Forman [Mon, 12 Sep 2022 20:49:38 +0000 (13:49 -0700)]
dunno what that was

22 months agoBringing over some of the "upgrades". 2
Simon Forman [Sun, 11 Sep 2022 21:07:55 +0000 (14:07 -0700)]
Bringing over some of the "upgrades". 2

22 months agoBringing over some of the "upgrades".
Simon Forman [Sun, 11 Sep 2022 20:57:19 +0000 (13:57 -0700)]
Bringing over some of the "upgrades".

22 months agoid func
Simon Forman [Sun, 11 Sep 2022 18:46:10 +0000 (11:46 -0700)]
id func

22 months agoclearing out cruft
Simon Forman [Sun, 11 Sep 2022 18:44:48 +0000 (11:44 -0700)]
clearing out cruft

22 months agominor cleanup
Simon Forman [Sun, 11 Sep 2022 16:33:50 +0000 (09:33 -0700)]
minor cleanup

22 months agoPut definitions in the docstring.
Simon Forman [Sun, 11 Sep 2022 16:03:58 +0000 (09:03 -0700)]
Put definitions in the docstring.

Why not? ¯\_(ツ)_/¯

22 months agoModel expr as stack-of-stacks, minor cleanup.
Simon Forman [Sun, 11 Sep 2022 15:57:45 +0000 (08:57 -0700)]
Model expr as stack-of-stacks, minor cleanup.

22 months agoDon't bother to return the expression.
Simon Forman [Sun, 11 Sep 2022 00:42:38 +0000 (17:42 -0700)]
Don't bother to return the expression.

We mutate it instead of replacing it with new versions.

22 months agoCleaner iteration of expression.
Simon Forman [Sun, 11 Sep 2022 00:37:07 +0000 (17:37 -0700)]
Cleaner iteration of expression.

It's a destructive operation.  It breaks functional purity (but it could
be made functional by using a stack instead of a list for the stack.)

There's no point to returning the expression object now because it's
being mutated by the prepend() method (rather than being replaced by new
forms.)

22 months agoover
Simon Forman [Sun, 11 Sep 2022 00:31:56 +0000 (17:31 -0700)]
over

This slipped through the cracks, eh?  Should add a test to joytest.

22 months agoNo point in a separate _parse() function.
Simon Forman [Sun, 11 Sep 2022 00:22:37 +0000 (17:22 -0700)]
No point in a separate _parse() function.

22 months agoSimpler tokenizer.
Simon Forman [Sun, 11 Sep 2022 00:08:46 +0000 (17:08 -0700)]
Simpler tokenizer.

Once the syntax was simple enough the re.Scanner became overkill.

From
http://norvig.com/lispy.html
by way of
https://github.com/ckkashyap/s2c

22 months agoA bit more docs.
Simon Forman [Fri, 9 Sep 2022 18:58:35 +0000 (11:58 -0700)]
A bit more docs.

22 months agoMove ParseError to parser section; add a few type guards.
Simon Forman [Fri, 9 Sep 2022 03:59:12 +0000 (20:59 -0700)]
Move ParseError to parser section; add a few type guards.

22 months agoMinor cleanup.
Simon Forman [Thu, 8 Sep 2022 21:25:02 +0000 (14:25 -0700)]
Minor cleanup.

22 months agoExpression objects.
Simon Forman [Thu, 8 Sep 2022 18:31:09 +0000 (11:31 -0700)]
Expression objects.

This should be more efficient than concat().

22 months agoblacken
Simon Forman [Thu, 8 Sep 2022 17:37:46 +0000 (10:37 -0700)]
blacken

22 months agomove stack code up under interp & minor edits
Simon Forman [Thu, 8 Sep 2022 16:06:11 +0000 (09:06 -0700)]
move stack code up under interp & minor edits

22 months agomake type checks into Joy functions
Simon Forman [Thu, 8 Sep 2022 15:46:34 +0000 (08:46 -0700)]
make type checks into Joy functions