Commit Graph

1358 Commits

Author SHA1 Message Date
Kartik Agaram 2c3dda21de 5685 - back tinkering with mulisp 2019-09-22 09:58:47 -07:00
Kartik Agaram 0ca3aa4acc 5682 2019-09-20 11:09:07 -07:00
Kartik Agaram 866bc06660 5679 - braces seem done 2019-09-20 10:04:51 -07:00
Kartik Agaram 4ac2020fe8 5678 2019-09-19 23:40:53 -07:00
Kartik Agaram a19dddcabe 5676 2019-09-19 23:29:28 -07:00
Kartik Agaram fd91f7f61b 5675 - move helpers from subx-common into layers
This undoes 5672 in favor of a new plan:

Layers 000 - 099 are for running without syntax sugar. We use them for
building syntax-sugar passes.

Layers 100 and up are for running with all syntax sugar.

The layers are arranged in approximate order so more phases rely on earlier
layers than later ones.

I plan to not use intermediate syntax sugar (just sigils without calls,
or sigils and calls without braces) anywhere except in the specific passes
implementing them.
2019-09-19 23:25:49 -07:00
Kartik Agaram 8a73e0d19a 5673 - standardize a few knobs 2019-09-19 16:32:10 -07:00
Kartik Agaram dfbe155087 5672 - move hex out of apps 2019-09-19 15:59:22 -07:00
Kartik Agaram 68666b07b8 5669 2019-09-19 15:19:07 -07:00
Kartik Agaram a9d473e224 5668 - start reorg to permit syntax sugar in layers
Right now we always build the library before any apps.
Apps are where our syntax sugar translators (sigils, calls, braces) live.
So we can't use sugar in the standard library.

New idea: move all code for SubX phases into the top-level.
Perhaps we should also just build a single file rather than pipeline stages.
But for now we'll build each phase by building up to some specific layer.

This will simplify test_apps and move lots of one-off logic to a more standard
form in test_layers.

I'm also going to reorg existing layers so that we introduce each phase
at a point where it mostly only gets the helpers it needs.

This commit itself is just cleaning up some common strings. Using explicit
names for them streamlines binaries a bit.
2019-09-19 15:12:50 -07:00
Kartik Agaram 37d40d4096 5667 2019-09-19 08:39:57 -07:00
Kartik Agaram 6ecddbaa92 5666 - start of sugar for structured control flow 2019-09-19 00:33:21 -07:00
Kartik Agaram 20b71ee7f4 5664 2019-09-18 11:51:05 -07:00
Kartik Agaram fd2b373ad0 5663
Snapshot of mulisp before we put it on the back-burner. It's going to take
too long, and we're better off building out the lower layers that make
it more convenient to create.
2019-09-18 11:42:08 -07:00
Kartik Agaram f39eaf81fa 5661 2019-09-15 00:29:52 -07:00
Kartik Agaram ecfbbfb5b5 5647 - experimental support for swapping OS 2019-09-11 19:53:23 -07:00
Kartik Agaram 4d53de8afa 5646 2019-09-11 17:49:34 -07:00
Kartik Agaram 27decf77f2 5644 - plan data structures for mulisp 2019-09-08 00:33:57 -07:00
Kartik Agaram 57fa808b18 5637 2019-09-07 13:37:51 -07:00
Kartik Agaram 1fafe7afe3 5634 - add read/eval/print phases 2019-09-07 01:36:12 -07:00
Kartik Agaram d7dc6cf12f 5633 - start of a toy lisp interpreter 2019-09-07 01:34:07 -07:00
Kartik Agaram 099f0d5d55 5631 - syntax for calls starting to work!
Now added to CI.
2019-09-06 17:58:53 -07:00
Kartik Agaram e836615a60 5630 2019-09-06 16:17:51 -07:00
Kartik Agaram f9973de3b1 5627 2019-09-06 14:47:39 -07:00
Kartik Agaram 77641c35d3 5626 2019-09-06 10:40:06 -07:00
Kartik Agaram dde37113cb 5625 2019-09-05 00:33:34 -07:00
Kartik Agaram 0221c6d3d3 5624
Fix a bug in call.subx's tokenizer.
2019-09-05 00:26:26 -07:00
Kartik Agaram 77c96940d5 5623 2019-09-04 21:29:42 -07:00
Kartik Agaram 57e74034f2 5622 2019-09-04 21:25:55 -07:00
Kartik Agaram 3449c5893c 5621
Done with calls.subx's variant of next-word.
2019-09-04 18:16:06 -07:00
Kartik Agaram 7a69dd4dc6 5620
Further flesh out next-word variant for calls.subx. All the code is
sketched out, and baseline tests pass. No tests yet for new
functionality compared to sigils.subx.
2019-09-04 17:47:38 -07:00
Kartik Agaram 719dec729c 5616 2019-09-04 17:30:40 -07:00
Kartik Agaram 3a8c4df29f 5615 - long strings in self-hosted translator
My SubX translator phases assume lines are never longer than 512 bytes.
However, dquotes.subx was generating lines longer than that by blowing
up string literals by 4-5x.
2019-09-04 16:57:57 -07:00
Kartik Agaram 904a053e9c 5613
Translating common bits from sigils.subx expression-aware variant of
next-word to use sigils in calls.subx.
2019-09-03 18:04:49 -07:00
Kartik Agaram ae07bf353c 5612 2019-09-02 16:34:31 -07:00
Kartik Agaram e8a1153af1 5611 2019-09-02 15:46:15 -07:00
Kartik Agaram 18bd3ef902 5607 - start of notation for function calls 2019-09-02 15:36:08 -07:00
Kartik Agaram 968380517a 5608 - write int to stream 2019-09-02 15:15:11 -07:00
Kartik Agaram 604c8315bd 5607 2019-09-01 23:57:29 -07:00
Kartik Agaram 7a81a4505c 5606 2019-09-01 23:38:06 -07:00
Kartik Agaram b44c754bc0 5605 - sigils: support *disp32 2019-09-01 23:22:39 -07:00
Kartik Agaram 6165d6ece9 5604 2019-09-01 14:00:56 -07:00
Kartik Agaram c94ecaf687 5603 2019-09-01 00:39:17 -07:00
Kartik Agaram cafca95097 5602 2019-09-01 00:12:43 -07:00
Kartik Agaram 075354cd17 5601 2019-08-31 23:58:19 -07:00
Kartik Agaram 282681c729 5600 2019-08-31 23:42:45 -07:00
Kartik Agaram f3ab82e943 5599 - sigils: support metadata in %reg and *reg
We already support metadata after *(...)
No plans to support metadata _inside_ *(...)
2019-08-31 23:00:11 -07:00
Kartik Agaram 518429b1cb 5598 2019-08-31 22:34:56 -07:00
Kartik Agaram bf02a19d02 5596 2019-08-31 22:18:24 -07:00
Kartik Agaram 3046e34da8 5595 - support ebp and esp in sigils
The x86 instruction set carves out exceptions for these registers.
2019-08-31 22:14:11 -07:00
Kartik Agaram e97b446ac3 5594 - rename 'desugar' to 'sigils'
There's going to be multiple forms of syntax sugar going forward.
2019-08-31 20:43:41 -07:00
Kartik Agaram 333525360b 5592 - switch register names to lowercase 2019-08-26 11:59:21 -07:00
Kartik Agaram 22fb844ba4 5591 2019-08-26 11:54:29 -07:00
Kartik Agaram e0d034b565 5590 2019-08-25 23:33:49 -07:00
Kartik Agaram fc55af70a5 5589 2019-08-25 23:25:08 -07:00
Kartik Agaram d8c2f71ce9 5586 - bugfix: no desugar inside string literals 2019-08-25 22:03:23 -07:00
Kartik Agaram 7c878eb0ea 5583
Clean up some missing error messages.
2019-08-25 16:29:10 -07:00
Kartik Agaram 9ac3fde9ab 5581 2019-08-25 15:12:56 -07:00
Kartik Agaram 57fdbeb2b6 . 2019-08-25 15:07:46 -07:00
Kartik Agaram 0d3b3ef04a Merge branch 'master' into desugar 2019-08-25 15:04:26 -07:00
Kartik Agaram 0a288d46b9 desugar: more integration tests 2019-08-25 14:45:21 -07:00
Kartik Agaram 3cf0ec28d4 desugar: code-generation seems complete 2019-08-25 14:33:26 -07:00
Kartik Agaram f40528078d desugar: parsing seems complete 2019-08-25 00:59:52 -07:00
Kartik Agaram 380fc367b8 parsing *(reg-disp) 2019-08-25 00:32:24 -07:00
Kartik Agaram d230393c92 parsing *(reg+reg)
Turns out there's an ambiguity even in this simple one-line language:
when you see 'base+' you don't know whether the next token is the index
or displacement. (Whereas a '-' would be unambiguous but is still not
handled.)

Fixing this ambiguity adds 15 instructions worth of complexity.
2019-08-25 00:27:42 -07:00
Kartik Agaram be063736d0 parsing *(reg+disp) 2019-08-24 23:42:04 -07:00
Kartik Agaram cf529da986 . 2019-08-24 13:28:20 -07:00
Kartik Agaram 4f8b2bd2fb integration tests for desugaring indirect mode
They caught a logic error.
2019-08-24 13:06:34 -07:00
Kartik Agaram 9191049790 integration tests for desugaring direct mode 2019-08-24 13:06:10 -07:00
Kartik Agaram ab412890e5 use the results of parsing in emit-indirect-mode 2019-08-24 11:45:48 -07:00
Kartik Agaram 23ee933e12 parsing *(reg) 2019-08-24 11:36:37 -07:00
Kartik Agaram 33de6b8031 build out all variants for skipping whitespace
skip {whitespace, non-whitespace} x {from stream, from slice}
2019-08-24 08:18:09 -07:00
Kartik Agaram 60d59aec85 .
This is pretty complex, but I may not need any more registers.
2019-08-23 15:33:13 -07:00
Kartik Agaram e4ca252873 . 2019-08-23 15:04:47 -07:00
Kartik Agaram 88469e78ae .
Some reorg as I realize I may have painted myself into a corner in this
function. I have no registers left for the actual parsing.
2019-08-23 14:23:25 -07:00
Kartik Agaram 4b296ceef9 parsing *reg
Isn't used yet, but baby steps.
2019-08-23 13:51:29 -07:00
Kartik Agaram fee05edddd another error message 2019-08-23 11:21:13 -07:00
Kartik Agaram 4949dda554 . 2019-08-23 11:07:26 -07:00
Kartik Agaram ba5a2eff2c lexing complex expressions inside '*(...)' 2019-08-23 01:27:36 -07:00
Kartik Agaram ab87ccf62e couple of helpers for parsing expressions in parens 2019-08-22 00:25:41 -07:00
Kartik Agaram 0bb09d2e14 5522 - example app: random number stream
Turns out Mu's kernel isn't populating /dev/random correctly.
2019-08-20 00:20:38 -07:00
Kartik Agaram db1874cae2 . 2019-08-16 14:09:56 -07:00
Kartik Agaram 67dac668e3 sketch of a plan to implement indirect mode 2019-08-16 14:08:40 -07:00
Kartik Agaram c78f6b780b desugar: code-generate *reg 2019-08-16 00:34:27 -07:00
Kartik Agaram 343666bea3 plan for supporting indirect mode
It may superficially seem like there's a simpler approach:

- emit '3/mod' or '0/mod' depending on whether the character is '%' or '*'
- increment the start of word-slice
- look up the register and emit the appropriate /rm32

But that won't work for 1/mod or 2/mod. We're doing a little bit of
upfront planning.
2019-08-16 00:28:44 -07:00
Kartik Agaram 05b95e0aaf . 2019-08-16 00:12:31 -07:00
Kartik Agaram 37ea8c410e . 2019-08-16 00:10:55 -07:00
Kartik Agaram dbb380b87f add desugar to CI 2019-08-13 22:32:54 -07:00
Kartik Agaram 306812cc30 done implementing all variants of 'get' 2019-08-13 22:13:14 -07:00
Kartik Agaram 328a8e11f6 done with get-or-stop 2019-08-13 17:15:08 -07:00
Kartik Agaram 0059698b0b half-done testing get-or-stop
Probably not needed for desugar; I'm just working through what we may
replace the calls to 'get-slice' with if and when we decide to start
focusing error messages and so writing tests for them.
2019-08-13 12:40:25 -07:00
Kartik Agaram 63b8b18ef7 standardize test input/output/error streams 2019-08-13 12:27:15 -07:00
Kartik Agaram 64e8faba37 . 2019-08-13 12:19:49 -07:00
Kartik Agaram bfb2a8c0f0 get desugar working on the commandline 2019-08-13 10:57:05 -07:00
Kartik Agaram 64d51af46f . 2019-08-13 09:55:28 -07:00
Kartik Agaram d826a2d659 new variant: maybe-get-slice 2019-08-13 00:06:18 -07:00
Kartik Agaram 2b48729fd2 new variant: maybe-get returns null on failure 2019-08-12 23:39:53 -07:00
Kartik Agaram 15a84e2449 better error message when get aborts 2019-08-12 23:18:31 -07:00
Kartik Agaram 94d68ac244 extract table functions into their own layer 2019-08-11 23:30:20 -07:00
Kartik Agaram 37c859058d table-based register conversion
Requires a change to the C++ translator: support string literals in all
segments, not just the code segment.

(The self-hosted translator already had this.)
2019-08-01 14:50:19 -07:00
Kartik Agaram 70decc7aef .
First step to cleaning up `desugar-register`: extract the common '%' to
register literals.
2019-08-01 10:54:27 -07:00
Kartik Agaram d0016e126f desugar: code-generate %reg
We're no longer just emitting the register code. We emit all arguments
with appropriate metadata.
2019-07-31 19:18:28 -07:00
Kartik Agaram 34c86ff559 . 2019-07-31 17:37:09 -07:00
Kartik Agaram 129d812c2e Merge branch 'master' into desugar 2019-07-31 17:35:15 -07:00
Kartik Agaram 0b4e8494d6 desugar: clean up top-level `convert`
Model it on `dquotes` rather than `pack`, since it needs almost zero
state across words.

Manual testing:
  $ echo 'ab %eax' |subx run apps/desugar
  ab 0
2019-07-31 17:34:30 -07:00
Kartik Agaram 1ed1d1c842 5499 2019-07-31 15:28:23 -07:00
Kartik Agaram 070d5f2fc8 Merge branch 'master' into desugar 2019-07-28 13:40:29 -07:00
Kartik Agaram 6e1eeeebfb 5485 - promote SubX to top-level 2019-07-27 17:47:59 -07:00