Commit Graph

1358 Commits

Author SHA1 Message Date
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