Simon Forman
3d0b5ba266
cons
2023-02-05 09:40:47 -08:00
Simon Forman
fe4ce60541
dip
2023-02-05 08:49:05 -08:00
Simon Forman
4b3117e349
minor cleanup
2023-02-05 08:38:15 -08:00
Simon Forman
f34b4547a5
dup
2023-02-05 08:37:13 -08:00
Simon Forman
4181daf40c
minor cleanup
2023-02-05 08:12:32 -08:00
Simon Forman
b1a06979c2
truthy
2023-02-04 23:45:13 -08:00
Simon Forman
7874496090
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.
2023-02-04 23:08:39 -08:00
Simon Forman
15482c1fdd
A first attempt at definitions.
2023-02-04 22:58:38 -08:00
Simon Forman
b70229d727
Almost truthy...
2023-02-04 22:58:16 -08:00
Simon Forman
6159165acd
div and mod
2023-02-04 19:34:38 -08:00
Simon Forman
720f36a4c0
clear
2023-02-04 19:21:13 -08:00
Simon Forman
c3e786aed9
branch combinator.
2023-02-04 19:19:48 -08:00
Simon Forman
21f99aac96
i combinator.
2023-02-04 19:05:26 -08:00
Simon Forman
bd525cc7ac
Depend on joy.h.
2023-02-04 18:59:59 -08:00
Simon Forman
62ed15d17a
Minor cleanup, print_stack.
2023-02-04 18:51:58 -08:00
Simon Forman
8b4d265ed9
Minor cleanup.
2023-02-04 13:46:29 -08:00
Simon Forman
b76213ff7e
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.
2023-02-04 13:38:28 -08:00
Simon Forman
45865acc2f
Cmp, comes with GMP.
2023-02-04 12:47:45 -08:00
Simon Forman
42e7724e77
Boolean singleton values.
2023-02-04 11:27:03 -08:00
Simon Forman
81eebc5b9b
Boolean singleton values.
2023-02-04 10:25:14 -08:00
Simon Forman
71c25e7bbd
Node head is pointer now.
2023-02-04 08:12:30 -08:00
Simon Forman
2e4381b2c0
JoyListPtr too
2023-02-04 07:55:11 -08:00
Simon Forman
1eb8f1dde1
Use JoyListPtr.
2023-02-04 07:52:36 -08:00
Simon Forman
99fb04397f
sub and mul through judicious (I hope) use of macros.
2023-02-03 19:38:18 -08:00
Simon Forman
ecf79b9de0
pop_any(), pop_int(), and add
2023-02-03 15:46:52 -08:00
Simon Forman
3ae0e5b3a6
Interpret symbols.
...
C has function pointers, we can put them in the Gperf wordlist, this
makes the interpreter really simple. No need for a dictionary (yet).
Implementing the basis functions will be a bit of a slog, and
I still have to implement definitions, but this is starting to shape up
nicely.
2023-02-03 11:48:32 -08:00
Simon Forman
f2b2b92c2c
Yet more minor cleanup.
2023-02-03 09:39:02 -08:00
Simon Forman
7df01dfe5e
More minor cleanup.
2023-02-03 09:30:11 -08:00
Simon Forman
64eb28a648
Minor cleanup.
2023-02-03 09:27:30 -08:00
Simon Forman
8647f40895
newJoyList
2023-02-03 09:18:32 -08:00
Simon Forman
fb40b11fb0
Can haz function pointers in my worldist.
2023-02-03 08:13:57 -08:00
Simon Forman
cd98e01efc
typedef for the win!
2023-02-02 20:45:28 -08:00
Simon Forman
f74a0fe0fa
make clean rule
2023-02-02 17:02:55 -08:00
Simon Forman
4be1cc5767
Use gperf to save memory.
...
We check terms to see if they're in the wordlist, if they are we reuse
the string from the wordlist instead of allocating a new one.
(I've always wanted to use Gperf so I'm pretty stoked about this!)
2023-02-02 16:58:44 -08:00
Simon Forman
0a66f2b804
Ignore object files.
2023-02-02 16:14:11 -08:00
Simon Forman
8dcaee342d
minor cleanup
2023-02-02 16:13:15 -08:00
Simon Forman
a2a18a1d05
Gperf.
2023-02-02 16:12:59 -08:00
Simon Forman
70fc8c612c
Minor cleanup.
2023-02-02 13:22:11 -08:00
Simon Forman
e342fb31de
True and False values.
2023-02-02 13:06:07 -08:00
Simon Forman
ab8b26d6f0
Copyright, etc.
2023-02-02 11:14:58 -08:00
Simon Forman
dee703ea52
Fix bug with no trailing spaces.
...
Gotta update that pointer, eh?
2023-02-02 10:58:03 -08:00
Simon Forman
e393016a32
I was post-incrementing when I should have been pre-incrementing!
...
D'oh!
2023-02-02 08:52:27 -08:00
Simon Forman
b759582439
Simple terms work. Problem is with sub-lists.
2023-02-02 08:36:13 -08:00
Simon Forman
ebae69c391
Parsing isn't this hard?
2023-02-02 08:32:45 -08:00
Simon Forman
9356e5394b
Um, don't do that.
...
I wonder where the data was winding up?
2023-02-01 20:36:18 -08:00
Simon Forman
288142c01a
Minor cleanup.
2023-02-01 20:34:49 -08:00
Simon Forman
bb41bf619d
Remove separate parser code.
2023-02-01 20:34:04 -08:00
Simon Forman
5d47512bf5
Print true, false, and lists.
2023-02-01 20:33:04 -08:00
Simon Forman
b09055f299
Print ints.
2023-02-01 20:28:24 -08:00
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