OSDN Git Service
Simon Forman [Thu, 29 Sep 2022 01:28:25 +0000 (18:28 -0700)]
Clear out old docs; update defs.txt.
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.
Simon Forman [Thu, 29 Sep 2022 01:18:20 +0000 (18:18 -0700)]
Improve compiling of step combinator.
Simon Forman [Thu, 29 Sep 2022 01:16:45 +0000 (18:16 -0700)]
Initial outline for a talk on Joy.
Simon Forman [Sun, 25 Sep 2022 04:19:35 +0000 (21:19 -0700)]
coms, swap
Simon Forman [Sun, 25 Sep 2022 04:00:26 +0000 (21:00 -0700)]
Comparison operations.
Simon Forman [Sun, 25 Sep 2022 03:45:06 +0000 (20:45 -0700)]
branch, dip, i, loop
The core combinators (except fork).
Simon Forman [Sun, 25 Sep 2022 02:39:10 +0000 (19:39 -0700)]
Minor cleanup.
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.
Simon Forman [Sat, 24 Sep 2022 21:54:07 +0000 (14:54 -0700)]
Minor cleanup.
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?
Simon Forman [Sat, 24 Sep 2022 21:16:44 +0000 (14:16 -0700)]
autoformat
Simon Forman [Sat, 24 Sep 2022 21:16:20 +0000 (14:16 -0700)]
clear
Simon Forman [Sat, 24 Sep 2022 20:13:44 +0000 (13:13 -0700)]
Autoformat.
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!
Simon Forman [Sat, 24 Sep 2022 19:54:46 +0000 (12:54 -0700)]
Eval symbols...
Simon Forman [Sat, 24 Sep 2022 19:44:20 +0000 (12:44 -0700)]
Working towards interpretation.
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?
Simon Forman [Sat, 24 Sep 2022 18:00:19 +0000 (11:00 -0700)]
Parser.
Mighty battle.
Simon Forman [Sat, 24 Sep 2022 16:01:16 +0000 (09:01 -0700)]
Order is preserved.
Simon Forman [Sat, 24 Sep 2022 15:59:38 +0000 (08:59 -0700)]
A couple of little comments.
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...
Simon Forman [Sat, 24 Sep 2022 02:35:15 +0000 (19:35 -0700)]
A start of parsing tokens.
Simon Forman [Sat, 24 Sep 2022 00:47:31 +0000 (17:47 -0700)]
Formatting.
Simon Forman [Sat, 24 Sep 2022 00:31:16 +0000 (17:31 -0700)]
I think I got the tokenizer right.
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.
Simon Forman [Fri, 23 Sep 2022 15:54:37 +0000 (08:54 -0700)]
Ignoring _build.
Simon Forman [Fri, 23 Sep 2022 15:53:39 +0000 (08:53 -0700)]
Ignore _build dirs.
Simon Forman [Fri, 23 Sep 2022 15:38:17 +0000 (08:38 -0700)]
autoformat
Simon Forman [Fri, 23 Sep 2022 15:37:04 +0000 (08:37 -0700)]
Ocaml FTW!
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.
Simon Forman [Fri, 23 Sep 2022 03:08:24 +0000 (20:08 -0700)]
Create an int and add ints.
Simon Forman [Fri, 23 Sep 2022 02:34:57 +0000 (19:34 -0700)]
Try using GC_register_finalizer?
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
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.
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().
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?)
Simon Forman [Thu, 22 Sep 2022 16:13:11 +0000 (09:13 -0700)]
Let's play with more cores.
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?
Simon Forman [Wed, 21 Sep 2022 00:14:41 +0000 (17:14 -0700)]
Parse the tokens into a Joy expression.
Simon Forman [Tue, 20 Sep 2022 23:29:35 +0000 (16:29 -0700)]
Parser in GNU Prolog.
Wonky handling of UTF_8 blankspace.
Simon Forman [Tue, 20 Sep 2022 21:22:47 +0000 (14:22 -0700)]
The whole thing is kind of a mess.
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.
Simon Forman [Tue, 20 Sep 2022 18:12:28 +0000 (11:12 -0700)]
Remove cruft.
Simon Forman [Tue, 20 Sep 2022 17:20:58 +0000 (10:20 -0700)]
Minor cleanup.
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. ;)
Simon Forman [Tue, 20 Sep 2022 02:43:34 +0000 (19:43 -0700)]
Fix typo in hyperlink in README.
Simon Forman [Mon, 19 Sep 2022 20:25:09 +0000 (13:25 -0700)]
Minor cleanup.
Simon Forman [Mon, 19 Sep 2022 20:22:31 +0000 (13:22 -0700)]
Add a flowchart for the interpreter.
Using PlantUML.
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.
Simon Forman [Sat, 17 Sep 2022 00:54:42 +0000 (17:54 -0700)]
Remove old docs.
Simon Forman [Fri, 16 Sep 2022 19:28:13 +0000 (12:28 -0700)]
A bit more docs.
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.
Simon Forman [Fri, 16 Sep 2022 18:06:30 +0000 (11:06 -0700)]
Whence fun_with_scan and with_sympy?
Simon Forman [Fri, 16 Sep 2022 16:03:42 +0000 (09:03 -0700)]
Cleaning up docs.
Kinda...
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!"
Simon Forman [Fri, 16 Sep 2022 14:35:11 +0000 (07:35 -0700)]
Function Reference
Simon Forman [Fri, 16 Sep 2022 02:17:56 +0000 (19:17 -0700)]
bits and pieces
Simon Forman [Fri, 16 Sep 2022 01:14:01 +0000 (18:14 -0700)]
Rework docs, simpler (no Sphinx.)
Simon Forman [Fri, 16 Sep 2022 01:11:16 +0000 (18:11 -0700)]
delete all the extra notebook conversions
Simon Forman [Thu, 15 Sep 2022 16:34:39 +0000 (09:34 -0700)]
Ignore the Nim joy binary.
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.
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
Simon Forman [Thu, 15 Sep 2022 03:15:25 +0000 (20:15 -0700)]
Let simplejoy be joy.
Simple pleasures are the best.
Simon Forman [Thu, 15 Sep 2022 03:14:34 +0000 (20:14 -0700)]
Remove old code.
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.)
Simon Forman [Thu, 15 Sep 2022 01:51:58 +0000 (18:51 -0700)]
basis complete
Simon Forman [Wed, 14 Sep 2022 22:48:25 +0000 (15:48 -0700)]
dup, first, i, loop
Simon Forman [Wed, 14 Sep 2022 22:04:07 +0000 (15:04 -0700)]
dip and cons
Simon Forman [Wed, 14 Sep 2022 21:36:29 +0000 (14:36 -0700)]
Rewrite expression to use list instead of list node.
Simon Forman [Wed, 14 Sep 2022 20:31:44 +0000 (13:31 -0700)]
Minor cleanup.
Simon Forman [Wed, 14 Sep 2022 18:24:56 +0000 (11:24 -0700)]
Reuse as_list().
Simon Forman [Wed, 14 Sep 2022 17:49:13 +0000 (10:49 -0700)]
Cleaning up the code.
Simon Forman [Wed, 14 Sep 2022 16:49:33 +0000 (09:49 -0700)]
Nimpretty reformat. Two-space indentation.
Simon Forman [Wed, 14 Sep 2022 16:46:31 +0000 (09:46 -0700)]
Minor cleanup
Simon Forman [Wed, 14 Sep 2022 16:45:34 +0000 (09:45 -0700)]
Let's pile Nim code into one file too, why not?
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.
Simon Forman [Mon, 12 Sep 2022 23:07:21 +0000 (16:07 -0700)]
step, times
Simon Forman [Mon, 12 Sep 2022 22:17:32 +0000 (15:17 -0700)]
dipd, dipdd, cmp
Simon Forman [Mon, 12 Sep 2022 20:50:40 +0000 (13:50 -0700)]
cond
Simon Forman [Mon, 12 Sep 2022 20:50:07 +0000 (13:50 -0700)]
updated defs via make
Simon Forman [Mon, 12 Sep 2022 20:49:38 +0000 (13:49 -0700)]
dunno what that was
Simon Forman [Sun, 11 Sep 2022 21:07:55 +0000 (14:07 -0700)]
Bringing over some of the "upgrades". 2
Simon Forman [Sun, 11 Sep 2022 20:57:19 +0000 (13:57 -0700)]
Bringing over some of the "upgrades".
Simon Forman [Sun, 11 Sep 2022 18:46:10 +0000 (11:46 -0700)]
id func
Simon Forman [Sun, 11 Sep 2022 18:44:48 +0000 (11:44 -0700)]
clearing out cruft
Simon Forman [Sun, 11 Sep 2022 16:33:50 +0000 (09:33 -0700)]
minor cleanup
Simon Forman [Sun, 11 Sep 2022 16:03:58 +0000 (09:03 -0700)]
Put definitions in the docstring.
Why not? ¯\_(ツ)_/¯
Simon Forman [Sun, 11 Sep 2022 15:57:45 +0000 (08:57 -0700)]
Model expr as stack-of-stacks, minor cleanup.
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.
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.)
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.
Simon Forman [Sun, 11 Sep 2022 00:22:37 +0000 (17:22 -0700)]
No point in a separate _parse() function.
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
Simon Forman [Fri, 9 Sep 2022 18:58:35 +0000 (11:58 -0700)]
A bit more docs.
Simon Forman [Fri, 9 Sep 2022 03:59:12 +0000 (20:59 -0700)]
Move ParseError to parser section; add a few type guards.
Simon Forman [Thu, 8 Sep 2022 21:25:02 +0000 (14:25 -0700)]
Minor cleanup.
Simon Forman [Thu, 8 Sep 2022 18:31:09 +0000 (11:31 -0700)]
Expression objects.
This should be more efficient than concat().
Simon Forman [Thu, 8 Sep 2022 17:37:46 +0000 (10:37 -0700)]
blacken
Simon Forman [Thu, 8 Sep 2022 16:06:11 +0000 (09:06 -0700)]
move stack code up under interp & minor edits