Commit Graph

6690 Commits

Author SHA1 Message Date
Kartik Agaram 525c398636 6540 - arith: mul
I forgot that Mu doesn't have div yet.
2020-06-15 23:23:09 -07:00
Kartik Agaram 99a8ea89e2 6539 - arith: start on mul/div 2020-06-15 23:06:07 -07:00
Kartik Agaram cdc9a7f57f 6538 - arith: multi-ary arithmetic 2020-06-15 23:04:58 -07:00
Kartik Agaram 03a719d04b 6537 2020-06-15 22:51:02 -07:00
Kartik Agaram eeb250a746 6536
Cleaner way to handle EOF.
2020-06-15 22:48:07 -07:00
Kartik Agaram 9f0e69f19b 6535 2020-06-15 22:41:38 -07:00
Kartik Agaram 705dfd8587 6534 - arith: add/subtract 2020-06-15 19:37:07 -07:00
Kartik Agaram 2041ce7e59 6533 - arith: ignore spaces 2020-06-15 19:24:42 -07:00
Kartik Agaram dce8ad424d 6532 - arith: REPL converting ints to hex
I'm using one character of lookahead, inspired by Crenshaw's "let's build
a compiler".
2020-06-15 18:19:17 -07:00
Kartik Agaram 5fe0bc1688 6531 2020-06-15 18:05:23 -07:00
Kartik Agaram 538805df51 6530
New prototype: a simple 4-operator calculator. Inspired (yet again) by
Crenshaw.
2020-06-15 17:38:28 -07:00
Kartik Agaram d292196ff5 6529 - don't let `addr`s escape functions
I've gone back and forth on this. I initially disallowed this, then allowed
it because I forgot why I disallowed it. The reason to disallow it: if
you return an `addr` to a variable allocated on the stack, the space might
be reused for a different type, which violates type-safety. And once you
can reinterpret bits of one type as another you lose memory-safety as well.

This has some interesting implications for Mu programs; certain kinds of
helper functions become impossible to write. Now I find myself relying a
lot more on scopes (and editor folding support) for abstracting details.
And they won't help manage duplication. We'll see how this goes.

While I'm being draconian about `addr`s on the stack, I'm still abusing
`addr`s on the heap, with the expectation that future checks on reclamation
will protect me. The boon and bane of stack space is that it's constantly
reclaimed.
2020-06-15 17:13:04 -07:00
Kartik Agaram 5a6d2d0db7 6528 2020-06-15 16:57:39 -07:00
Kartik Agaram 27a5b1a892 6527 - increase stack limits
We haven't run into this limit yet, but everytime I see a 'stream overflow'
error I run into it while going over all the knobs in apps/subx-params.subx,
if I increase Input-size (used by survey.subx) too much.
2020-06-15 16:16:00 -07:00
Kartik Agaram 36c2d2eadd 6526 2020-06-15 15:23:50 -07:00
Kartik Agaram 43957d3ce5 6525 2020-06-15 14:16:38 -07:00
Kartik Agaram 39bcd3a8bc 6524 2020-06-15 14:11:11 -07:00
Kartik Agaram 532068bfc6 6523
Still some issues; add some tests. I have more that were passing a couple
of days ago but aren't currently.
2020-06-15 14:06:30 -07:00
Kartik Agaram 89c2b59a5f 6522 - redo support for 'byte'
Before: bytes can't live on the stack, so size(byte) == 1 just for array
elements.

After: bytes mostly can't live on the stack except for function args (which
seem too useful to disallow), so size(byte) == 4 except there's now a new
primitive called element-size for array elements where size(byte) == 1.

Now apps/browse.subx starts working again.
2020-06-15 14:02:41 -07:00
Kartik Agaram 5945986cc5 6521 - new primitive: array size in bytes 2020-06-14 00:40:16 -07:00
Kartik Agaram ad61776f49 6520 - new app: parse-int
Several bugs fixed in the process, and expectation of further bugs is growing.
I'd somehow started assuming I don't need to have separate cases for rm32
as a register vs mem. That's not right. We might need more reg-reg Primitives.
2020-06-14 00:28:23 -07:00
Kartik Agaram ead3d08e77 6519
More fucking amateur hour.
2020-06-13 23:15:15 -07:00
Kartik Agaram 57f92a9334 6518 - extra args through a whole swathe of places
Most unbelievably, I'd forgotten to pass the output 'out' arg to 'lookup-var'
long before the recent additions of 'err' and 'ed' args. But things continued
to work because an earlier call just happened to leave the arg at just
the right place on the stack. So we only caught all these places when we
had to provide error messages.
2020-06-13 23:05:51 -07:00
Kartik Agaram 002f03dde2 6517 2020-06-13 20:27:14 -07:00
Kartik Agaram ef845524e9 6516 - operations on bytes
Byte-oriented addressing is only supported in a couple of instructions
in SubX. As a result, variables of type 'byte' can't live on the stack,
or in registers 'esi' and 'edi'.
2020-06-13 20:23:51 -07:00
Kartik Agaram 7e55a20ff4 6515 - error if 'get' on unknown field
We can't yet say in the error message precisely where the 'get' occurs.
2020-06-12 23:04:22 -07:00
Kartik Agaram 166c61430b 6514 2020-06-12 09:28:25 -07:00
Kartik Agaram 86351aafe2 6513 2020-06-12 07:57:38 -07:00
Kartik Agaram 07dba48f13 6512 2020-06-12 00:46:06 -07:00
Kartik Agaram 0e20925078 6511 - start of error-checking
We now raise an error if a variable is declared on the stack with an initializer.
And there are unit tests for this functionality.
2020-06-12 00:43:50 -07:00
Kartik Agaram 32ada0e139 6510 2020-06-11 08:11:45 -07:00
Kartik Agaram 73cec3939f 6509 - mu.subx: exit-descriptors everywhere 2020-06-11 08:01:37 -07:00
Kartik Agaram 80f53f4a18 6508 - support null exit-descriptor 2020-06-10 23:34:42 -07:00
Kartik Agaram 7dac9ade15 6507 - use syscall names everywhere 2020-06-10 23:09:30 -07:00
Kartik Agaram 72d893b6b1 6506 2020-06-10 10:56:14 -07:00
Kartik Agaram 33f63cb0e6 6505 2020-06-09 09:38:52 -07:00
Kartik Agaram 62b301930f 6504 2020-06-08 10:01:27 -07:00
Kartik Agaram bc59779338 6503 2020-06-08 00:11:24 -07:00
Kartik Agaram 2d0c3b3e68 6502 2020-06-07 23:59:08 -07:00
Kartik Agaram 8093143f04 6501
Bugfix in support for CRLF line-endings.
2020-06-07 23:50:28 -07:00
Kartik Agaram 73b7be20eb 6500
Minor formatting tweaks.
2020-06-07 23:49:53 -07:00
Kartik Agaram 64bf0e8b97 6499 2020-06-07 15:43:13 -07:00
Kartik Agaram e2e0f5cce7 6498
Switch bullet lists in Markdown files away from `*`; it's ambiguous with
emphasis.
2020-06-06 15:55:03 -07:00
Kartik Agaram d7394beca6 6497 2020-06-06 15:53:15 -07:00
Kartik Agaram fb778c1d86 6496 2020-06-06 15:43:42 -07:00
Kartik Agaram 6e8f8c549a 6495 2020-06-06 15:41:15 -07:00
Kartik Agaram ef0bee8dfc 6494 2020-06-06 15:37:16 -07:00
Kartik Agaram 0b9cdbd0dd 6493 - browse: '#'s inside lines aren't headings 2020-06-06 11:14:24 -07:00
Kartik Agaram 8f5a26d5c2 6492 2020-06-06 10:09:07 -07:00
Kartik Agaram bab5ded561 6491 2020-06-06 08:31:36 -07:00