about summary refs log tree commit diff stats
path: root/apps/mu.subx
Commit message (Collapse)AuthorAgeFilesLines
* 6908 - compiling all floating-point operationsKartik Agaram2020-09-301-41/+725
| | | | | We don't yet support emulating these instructions in `bootstrap`. But generated binaries containing them run natively just fine.
* 6907 - converting to and from floating-pointKartik Agaram2020-09-291-9/+163
| | | | Some bugfixes to the previous commit.
* 6906Kartik Agaram2020-09-291-4/+4
|
* 6905 - first floating-point instruction compilingKartik Agaram2020-09-291-2/+275
| | | | (Though the generated code doesn't work yet.)
* 6904Kartik Agaram2020-09-291-133/+266
| | | | | New fields for primitives to support code-generation for floating-point primitives.
* 6903Kartik Agaram2020-09-291-0/+29
| | | | | | | | | | | | | | | | | | | Make a few tests more self-contained. I'd prefer to just run a function called `setup` first thing on startup and move this portion of convert-mu to it: # initialize global data structures c7 0/subop/copy *Next-block-index 1/imm32 8b/-> *Primitive-type-ids 0/r32/eax 89/<- *Type-id 0/r32/eax # stream-write c7 0/subop/copy *_Program-functions 0/imm32 c7 0/subop/copy *_Program-functions->payload 0/imm32 c7 0/subop/copy *_Program-types 0/imm32 c7 0/subop/copy *_Program-types->payload 0/imm32 c7 0/subop/copy *_Program-signatures 0/imm32 c7 0/subop/copy *_Program-signatures->payload 0/imm32 However, this approach doesn't fix my run_one_test tooling.
* 6902Kartik Agaram2020-09-291-2/+60
|
* 6901Kartik Agaram2020-09-291-8/+32
|
* 6900 - mu.subx: new primitive type 'float'Kartik Agaram2020-09-291-7/+29
| | | | Using it will currently emit incorrect programs.
* 6899Kartik Agaram2020-09-291-2/+2
|
* 6891Kartik Agaram2020-09-271-1/+1
|
* 6846Kartik Agaram2020-09-231-0/+65
|
* 6829 - tile: colorize values on the stackKartik Agaram2020-09-211-0/+49
|
* 6802 - plug a gaping hole in the Mu translatorKartik Agaram2020-09-191-0/+125
| | | | | This issue hasn't been noticed until now because I haven't been using variables on the stack much.
* 6782Kartik Agaram2020-09-151-0/+15
| | | | | | | Regression: segfault on `fn foo` without a block I really need to turn the list of scenarios considered before populate-mu-function-header into tests.
* 6781 - new app: RPN (postfix) calculatorKartik Agaram2020-09-151-0/+7
| | | | This was surprisingly hard; bugs discovered all over the place.
* 6742 - support for formatting in fake screensKartik Agaram2020-09-071-0/+61
| | | | | We still need a few primitives, but we can implement these as needed. I'm ready to call the fake screen done.
* 6727 - bugfix in a multiply instructionKartik Agaram2020-08-221-3/+4
| | | | Also more error-detection for this case all across the toolchain.
* 6726Kartik Agaram2020-08-221-2/+2
|
* 6725 - support negative literalsKartik Agaram2020-08-221-9/+27
|
* 6722Kartik Agaram2020-08-221-24/+123
|
* 6719 - error-checking for 'index' instructionsKartik Agaram2020-08-211-2/+1216
| | | | | | | | 1000+ LoC spent; just 300+ excluding tests. Still one known gap; we don't check the entirety of an array's element type if it's a compound. So far we just check if say both sides start with 'addr'. Obviously that's not good enough.
* 6715Kartik Agaram2020-08-031-0/+7
| | | | | | | | | | | | | | | | | | | | | | | There's a question of how we should match array types with a capacity on ones without. For now we're going to do the simplest possible thing and just make type-match? more robust. It'll always return false if the types don't match exactly. For ignoring capacity we'll rely on the checks of the `address` operation (which don't exist yet). This means we should do this to pass an address to an array to a function f with signature `f (addr array int)`: var a: (array int 3) var b/eax: (addr array int) <- address a f b rather than this: var a: (array int 3) var b/eax: (addr array int 3) <- address a f b Similar reasoning applies to stream types. Arrays and streams are currently the only types that can have an optional capacity.
* 6706 - support utf-8Kartik Agaram2020-08-021-0/+2
| | | | | | | | | | | | | | For example: fn main -> r/ebx: int { var x/eax: grapheme <- copy 0x9286e2 # code point 0x2192 in utf-8 print-grapheme-to-real-screen x print-string-to-real-screen "\n" } Graphemes must fit in 4 bytes (21 bits for code points). Unclear what we should do for longer clusters since graphemes are a fixed-size type at the moment.
* 6703 - new types: code-point and graphemeKartik Agaram2020-08-021-1/+3
| | | | | | | | | | Both have the same size: 4 bytes. So far I've just renamed print-byte to print-grapheme, but it still behaves the same. I'm going to support printing code-points next, but grapheme 'clusters' spanning multiple code-points won't be supported for some time.
* 6702Kartik Agaram2020-08-021-3/+18
|
* 6701Kartik Agaram2020-08-021-2/+4
|
* 6691 - start building a fake screenKartik Agaram2020-07-311-6/+98
| | | | There was a bug in defining types containing other user-defined types.
* 6687 - stream-empty? and stream-full?Kartik Agaram2020-07-301-1/+65
|
* 6684 - experimental primitives for streamsKartik Agaram2020-07-291-0/+197
| | | | | | | | | | | | | | | | | | | | | This is a hacky special case. The alternative would be more general support for generics. One observation: we might be able to type-check some primitives using `sig`s. Only if they don't return anything, since primitives usually need to support arbitrary registers. I'm not doing that yet, though. It eliminates the possibility of writing tests for them in mu.subx, which can't see 400.mu. But it's an alternative: sig allocate out: (addr handle _) sig populate out: (addr handle array _), n: int sig populate-stream out: (addr handle stream _), n: int sig read-from-stream s: (addr stream _T), out: (addr _T) sig write-to-stream s: (addr stream _T), in: (addr _T) We could write the tests in Mu. But then we're testing behavior rather than the code generated. There are trade-offs. By performing type-checking in mu.subx I retain the option to write both kinds of tests.
* 6683Kartik Agaram2020-07-281-10/+6
|
* 6682 - experimental support for streams and slicesKartik Agaram2020-07-281-9/+210
| | | | | | | | | Slices contain `addr`s so the same rules apply to them. They can't be stored in structs and so on. But they may be an efficient temporary while parsing. Streams are currently a second generic type after arrays, and gradually strengthening the case to just bite the bullet and support first-class generics in Mu.
* 6681Kartik Agaram2020-07-261-2/+2
|
* 6676 - type checks for 'lookup'Kartik Agaram2020-07-251-24/+0
|
* 6672 - error on addr or array inside typeKartik Agaram2020-07-251-7/+150
|
* 6671 - bugfix in generic functionsKartik Agaram2020-07-251-0/+1
| | | | | | We need to remember to clear local variables. And there's a good question here of how Mu supports variables of type stream or table. Or other user-defined types that inline arrays.
* 6670 - generic functionsKartik Agaram2020-07-251-3/+15
| | | | | | | | | | | | | | | | Function signatures can now take type parameters starting with '_'. Type parameters in a signature match any concrete type in the call. But they have to be consistent within a single call. Things I considered but punted on for now: - having '_' match anything without needing to be consistent. Wildcards actually seem harder to understand. - disallowing top-level '_' types. I'll wait until a concrete use case for disallowing. We still don't support *defining* types with type parameters, so for now this is only useful for calling functions on arrays or streams or handles.
* tmp - snapshot of type-parameter supportKartik Agaram2020-07-251-11/+125
| | | | | I think I've got all the stack management down. Time now for the business logic. There's one failing test.
* 6668Kartik Agaram2020-07-241-3/+4
| | | | type-match? is no longer symmetric; we have to be careful about arg ordering.
* 6667Kartik Agaram2020-07-241-1/+1
|
* 6666 - types starting with '_' now match anythingKartik Agaram2020-07-241-3/+85
| | | | We still need to perform pattern matching.
* 6665Kartik Agaram2020-07-241-4/+4
|
* 6664Kartik Agaram2020-07-241-5/+5
|
* 6663Kartik Agaram2020-07-241-1/+61
|
* 6662 - start support for genericsKartik Agaram2020-07-201-0/+100
| | | | Mu will be a language with generics -- but no static dispatch.
* 6661Kartik Agaram2020-07-201-3/+3
|
* 6660Kartik Agaram2020-07-201-2/+2
|
* 6650 - bit-shift operations really workingKartik Agaram2020-07-141-13/+266
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | test input: fn foo { var y/edx: int <- copy 0 y <- shift-left 2 y <- shift-right 2 y <- shift-right-signed 2 var x: int shift-left x, 2 shift-right x, 2 shift-right-signed x, 2 } output: foo: # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp { $foo:0x00000001:loop: ff 6/subop/push %edx ba/copy-to-edx 0/imm32 c1/shift 4/subop/left %edx 2/imm8 c1/shift 5/subop/right-padding-zeroes %edx 2/imm8 c1/shift 7/subop/right-preserving-sign %edx 2/imm8 68/push 0/imm32 c1/shift 4/subop/left *(ebp+0xfffffff8) 2/imm8 c1/shift 5/subop/right-padding-zeroes *(ebp+0xfffffff8) 2/imm8 c1/shift 7/subop/right-preserving-sign *(ebp+0xfffffff8) 2/imm8 81 0/subop/add %esp 0x00000004/imm32 8f 0/subop/pop %edx } $foo:0x00000001:break: # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp c3/return test input 2: $ cat x.mu fn main -> o/ebx: int { o <- copy 3 o <- shift-left 2 } output 2: $ ./translate_mu x.mu $ ./a.elf $ echo $? 12
* 6649Kartik Agaram2020-07-141-7/+137
| | | | | | Bit-shifts aren't quite right yet. We need to emit /imm8 rather than /imm32. This commit introduces the field, though we don't use it yet.
* 6648 - bit-shift instructions in MuKartik Agaram2020-07-141-0/+138
| | | | I'm not happy with the names.