Simon Forman
202747cfbb
Print list.
2023-02-01 20:09:03 -08:00
Simon Forman
cd0bfc09d2
Text to expr coming along.
2023-02-01 19:26:50 -08:00
Simon Forman
8ae9851c0f
Need to be able to store a string.
2023-02-01 18:37:10 -08:00
Simon Forman
66cbbac1cc
Minor cleanup.
2023-02-01 18:35:11 -08:00
Simon Forman
6b87e46e00
Minor cleanup.
...
Don't pass NULL to strpbrk().
2023-02-01 17:39:37 -08:00
Simon Forman
5118881e6c
Handle stretches of blanks.
...
Don't create zero-length strings.
2023-02-01 17:25:54 -08:00
Simon Forman
9762502ea6
Nice skeleton of parser.
2023-02-01 17:17:35 -08:00
Simon Forman
6694d3d596
Almost there on parsing.
2023-02-01 16:57:46 -08:00
Simon Forman
2f71db945a
trim_leading_blanks
2023-02-01 16:40:14 -08:00
Simon Forman
b8b37af1a4
Let's parse.
2023-02-01 16:02:19 -08:00
Simon Forman
e32d1d22e6
Don't version the binary.
2023-02-01 15:26:07 -08:00
Simon Forman
e44dd3c9e6
I think I'm doing this right?
2023-02-01 15:25:21 -08:00
Simon Forman
5a32c649f9
minor style glitch
2023-02-01 14:56:11 -08:00
Simon Forman
e211fff94f
Minor cleanup.
2023-02-01 14:55:21 -08:00
Simon Forman
d2048a3846
Some notebooks.
2023-02-01 14:54:07 -08:00
Simon Forman
28fa767593
Messing around with C.
2023-02-01 14:23:54 -08:00
Simon Forman
109cddae12
Readline support would be nice.
2022-10-17 17:51:12 -07:00
Simon Forman
ec5036bf63
This and that.
2022-10-15 20:04:27 -07:00
Simon Forman
74f936efa0
Cleanup and refactoring.
...
Bug when subtracting identical numbers. It gives
[false 0]
When it should be
[false]
or better yet
[true]
eh?
2022-10-15 11:05:17 -07:00
Simon Forman
062b01da55
That seems to work: addition and subtraction.
2022-10-15 09:52:58 -07:00
Simon Forman
c130026895
Mostly done with addition and subtraction.
2022-10-14 21:01:18 -07:00
Simon Forman
0b4b79f884
Not quite as smooth as I'd hoped.
2022-10-14 20:36:50 -07:00
Simon Forman
6ade65ef0c
Subtraction seems to work now.
2022-10-14 17:52:31 -07:00
Simon Forman
9ba9d055ac
Progress.
2022-10-13 23:10:41 -07:00
Simon Forman
8bedb77462
Adding like-sign bigints in Joy.
2022-10-11 11:37:38 -07:00
Simon Forman
e7f4a021fe
Misc stuff.
2022-10-10 22:28:50 -07:00
Simon Forman
5b852e7964
Minor cleanup.
2022-10-10 22:23:19 -07:00
Simon Forman
b48419ec1a
Add two lists of digits.
2022-10-10 20:32:57 -07:00
Simon Forman
756e1829d9
I think I got it.
...
Whew! Think slow and steady FTW. Don't get ahead of yourself. Put the
non-recursive parts in the non-recursive branch, duh.
2022-10-10 20:26:59 -07:00
Simon Forman
2cf2b56751
Dang it...
2022-10-10 18:39:35 -07:00
Simon Forman
92ffefd6f0
Minor cleanup.
2022-10-06 18:11:24 -07:00
Simon Forman
bad1a909c7
Just for me...
...
(That's how you look all clever, but it's a dick move removing the
commentary like that.)
2022-10-06 15:36:16 -07:00
Simon Forman
e085218490
Bisect for the win!
2022-10-06 15:34:34 -07:00
Simon Forman
1007cceab5
find_greatest()
...
I think it's ready to use...
2022-10-06 15:31:24 -07:00
Simon Forman
d8b346958a
Finish lil_divmod.
2022-10-06 08:04:54 -07:00
Simon Forman
c07a9e3ed9
One more lil bug squash.
...
Subsidiary functions...
Fuzz FTW.
2022-10-05 12:31:35 -07:00
Simon Forman
0e283f1052
Div Mod of same sign ints.
...
That seems to be that.
2022-10-05 12:21:46 -07:00
Simon Forman
634ff157bc
Flush out and squash some bugs.
2022-10-05 12:19:39 -07:00
Simon Forman
df42bbcb7d
I think I figured something out...
2022-10-05 10:16:47 -07:00
Simon Forman
339852a435
Kinda sorta not really working,
...
as in broken.
This is getting out of hand.
2022-10-05 09:15:41 -07:00
Simon Forman
0ee3d00537
Almost got it...
2022-10-05 08:49:35 -07:00
Simon Forman
70ea2c3f53
Divmod, yeah?
2022-10-05 08:27:01 -07:00
Simon Forman
e2f8d236cc
Minor cleanup.
...
I almost can't believe I did it. I guess I thought it would be harder
or more involved. Maybe divmod will be a pill?
Kinda relaxing after wasting the weekend nerd-sniped by curses.
2022-10-04 22:21:58 -07:00
Simon Forman
233f7431d6
Copyright and executable bit
2022-10-04 22:19:14 -07:00
Simon Forman
918e77b678
Minor cleanup.
2022-10-04 22:18:22 -07:00
Simon Forman
beafe3aff0
Minor cleanup; multiplication.
...
I forgot to commit after cleanup but before implementing multiplication
so this commit is kind of a mess.
Anyway, it works. :D
2022-10-04 22:06:49 -07:00
Simon Forman
217adaa318
test_Subtraction_large_from_small
2022-10-04 16:41:09 -07:00
Simon Forman
4cea474166
I guess subtraction works!?
2022-10-04 16:28:43 -07:00
Simon Forman
70b8bbdc0e
Adding two negative numbers.
2022-10-04 12:10:32 -07:00
Simon Forman
0333c3c522
That was easy! Add BigInts of the same sign.
2022-10-04 12:05:41 -07:00
Simon Forman
0817dcf4b1
Red... (Green, Refactor)
...
TDD FTW!
2022-10-04 11:37:55 -07:00
Simon Forman
21bd4bcfd3
Not using ctypes; test_twice_min
2022-10-04 11:31:40 -07:00
Simon Forman
151c580721
Minor cleanup.
2022-10-04 11:21:07 -07:00
Simon Forman
9ccc92d04c
Fix import.
2022-10-04 11:20:55 -07:00
Simon Forman
f0b6f4036a
BitInt start; unittest.
2022-10-04 11:20:14 -07:00
Simon Forman
53bea5f59b
That was easy...
...
but it breaks associativity or is it commutivity?
Anyway you can't add THREE or more things in one expression (yet)
because adding OberonInt objects returns a two-tuple.
I could adjust the semantics of ObInt to accept such two-tuples and do
add_with_carry() but that's probably more trouble than it's worth.
Just gotta be careful with math expressions, eh?
2022-10-04 08:53:32 -07:00
Simon Forman
690f157ac8
Switch to double-underscore method names.
...
Worry about type conversions later.
2022-10-04 08:49:40 -07:00
Simon Forman
e2f107d1bb
Subtraction.
2022-10-04 08:47:39 -07:00
Simon Forman
6ecf681d3a
BigInts in terms of Oberon Ints
...
Oberon RISC has Two's Complement 32-bit ints with carry.
So far so good.
2022-10-04 08:32:04 -07:00
Simon Forman
56fdf1eb18
Minor cleanup.
2022-09-28 22:07:28 -07:00
Simon Forman
abddda47da
Minor cleanup.
...
Functional Programming FTW!
2022-09-28 21:56:53 -07:00
Simon Forman
61bcf3588a
Apparently this is redundant.
...
Discovered by running `nim doc joy.nim`, compiling doesn't flag it.
2022-09-28 21:22:19 -07:00
Simon Forman
ec46cb6a2b
Clear out old docs; update defs.txt.
2022-09-28 18:28:25 -07:00
Simon Forman
cdec813b24
I had to model it in Python
...
before writing it in OCaml.
2022-09-28 18:21:13 -07:00
Simon Forman
4200c6708e
Improve compiling of step combinator.
2022-09-28 18:18:20 -07:00
Simon Forman
263ed2ee87
Initial outline for a talk on Joy.
2022-09-28 18:16:45 -07:00
Simon Forman
8159e102d3
coms, swap
2022-09-24 21:19:35 -07:00
Simon Forman
d94153583c
Comparison operations.
2022-09-24 21:00:45 -07:00
Simon Forman
c591bf4138
branch, dip, i, loop
...
The core combinators (except fork).
2022-09-24 20:45:06 -07:00
Simon Forman
3ecd7ab595
Minor cleanup.
2022-09-24 19:39:10 -07:00
Simon Forman
5e786db63f
Simple REPL.
...
Still very crude, and exceptions are not caught, but it works.
2022-09-24 19:33:29 -07:00
Simon Forman
10cdba844b
Minor cleanup.
2022-09-24 14:54:07 -07:00
Simon Forman
d99d9ee8aa
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?
2022-09-24 14:29:03 -07:00
Simon Forman
07f47a3b7a
autoformat
2022-09-24 14:16:44 -07:00
Simon Forman
0905cdc0da
clear
2022-09-24 14:16:20 -07:00
Simon Forman
813502532b
Autoformat.
2022-09-24 13:13:44 -07:00
Simon Forman
977928362c
Evaluation is working.
...
It's all downhill from here, like in skiing!
2022-09-24 13:13:03 -07:00
Simon Forman
5db538cc5c
Eval symbols...
2022-09-24 12:54:46 -07:00
Simon Forman
c7966f7ac8
Working towards interpretation.
2022-09-24 12:44:20 -07:00
Simon Forman
754fd1d1dc
Nice and clean.
...
I wonder what Ocaml programmers would think of this code?
2022-09-24 12:02:00 -07:00
Simon Forman
9e2d148fbf
Parser.
...
Mighty battle.
2022-09-24 11:00:19 -07:00
Simon Forman
0d88895ead
Order is preserved.
2022-09-24 09:01:16 -07:00
Simon Forman
c96cd6e296
A couple of little comments.
2022-09-24 08:59:38 -07:00
Simon Forman
4ff78dd65c
Parse tokens into joy_list.
...
That seemed a lot harder than it should have been...
2022-09-24 08:54:04 -07:00
Simon Forman
54d287bc32
A start of parsing tokens.
2022-09-23 19:35:15 -07:00
Simon Forman
97f715a10d
Formatting.
2022-09-23 17:47:31 -07:00
Simon Forman
f45d070856
I think I got the tokenizer right.
2022-09-23 17:31:16 -07:00
Simon Forman
4d7ed83238
So that's mutual recursion in Ocaml?
...
I like it. Just change "let" to "and" and you're good-to-go.
2022-09-23 08:59:06 -07:00
Simon Forman
d717b594c4
Ignoring _build.
2022-09-23 08:54:37 -07:00
Simon Forman
d0477eb516
Ignore _build dirs.
2022-09-23 08:53:39 -07:00
Simon Forman
64d4a42978
autoformat
2022-09-23 08:38:17 -07:00
Simon Forman
c76ae9979d
Ocaml FTW!
2022-09-23 08:37:04 -07:00
Simon Forman
8cb04fc72d
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.
2022-09-22 20:43:25 -07:00
Simon Forman
ae864909ee
Create an int and add ints.
2022-09-22 20:08:24 -07:00
Simon Forman
5caa685bab
Try using GC_register_finalizer?
2022-09-22 19:34:57 -07:00
Simon Forman
5ceab61ca1
Maybe this is the right thing to do?
...
https://stackoverflow.com/questions/59489221/using-the-gmp-library-with-boehms-garbage-collector
2022-09-22 19:00:40 -07:00
Simon Forman
813c5c0a23
What would a little C Joy look like?
...
Let's use GMP for ints and Boehm GC.
2022-09-22 17:26:28 -07:00
Simon Forman
92338037e7
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().
2022-09-22 13:20:30 -07:00
Simon Forman
0904bad81b
Capture and fwd exceptions in subforks.
...
(Should there be only one subtask? Do the other quote in the main
proc?)
2022-09-22 11:41:16 -07:00
Simon Forman
50293908d9
Let's play with more cores.
2022-09-22 09:13:11 -07:00