Commit Graph

280 Commits

Author SHA1 Message Date
Kartik K. Agaram
afadac25a4 505 - simplify tagged-value
I could swear there was an issue earlier where tagged-values had to
contain pointers for some core function. But I can't find it anymore.
Ok, assume we can store primitives in it and pointers only for
aggregates (and-records and arrays).
2015-01-05 23:57:19 -08:00
Kartik K. Agaram
0e465e41ad 500 2015-01-02 19:04:15 -08:00
Kartik K. Agaram
d1c1221822 497 - strengthen the concept of 'space'
'default-scope' is now 'default-space'
'closure-generator' is now 'next-space-generator'
The connection to high-level syntax for closures is now tenuous, so
we'll call the 'outer scope' the 'next space'.

So, let's try to create a few sentences with all these related ideas:

  Names map to addresses offset from a default-space when it's provided.

  Spaces can be strung together. The zeroth variable points to the next
  space, the one that is accessed when a variable has /space:1.

  To map a name to an address in the next space, you need to know what
  function generated that space. A corollary is that the space passed in
  to a function should always be generated by a single function.

Spaces can be used to construct lexical scopes and objects.
2015-01-02 18:20:18 -08:00
Kartik K. Agaram
565fe21ab2 475 - support symbol literals, just as a convenience 2014-12-31 21:15:26 -08:00
Kartik K. Agaram
3ccfdb38ae 468 - slice test time by 65%
We achieve this by separating out the freezing of system software, which
we needed to do anyway to address the duplication in 'init-fn'.
2014-12-30 15:13:51 -08:00
Kartik K. Agaram
2858b43647 467 - 'convert-names' now supports space metadata
To inform it about space metadata you have to tag environments with the
function that generated them. Every function can only ever be called
with environments generated by a single function. As an assembly-like
language, mu requires closures to be called with an explicit
environment, but it warns when the environment might not be what the
function expects.
2014-12-30 14:52:58 -08:00
Kartik K. Agaram
1f00ad3730 464 - reply broken in channel 'write'
How did this work until now? The reply was being treated as a label, and
if 'write' returned nothing it would still work fine because the output
is already present, and a missing 'reply' leaves oargs as-is.

Should we do something to catch this? Perhaps we should track args
modified and check that there are oargs for them. But that seems quite
heavyweight.. Maybe we should clear oargs when missing a 'reply'?
2014-12-30 14:37:04 -08:00
Kartik K. Agaram
9c729fb446 463 - mu now has closures 2014-12-30 01:27:26 -08:00
Kartik K. Agaram
5b07014681 461 - create room for an index '0' in scopes
This wasn't working until I fixed 459.
2014-12-29 09:20:51 -08:00
Kartik K. Agaram
0529508068 457 - finally, redirection works
No need for a separate channels array; just pass channels in globals.
The global space is a superset of unix's fd array.
2014-12-28 16:43:18 -08:00
Kartik K. Agaram
05a2cf45a5 456 - routines can now have routine globals
But we don't do nonsense like copy all state from the parent routine.
2014-12-28 15:57:55 -08:00
Kartik K. Agaram
3513e03850 453 2014-12-28 13:03:50 -08:00
Kartik K. Agaram
38e1f0bd01 451 - start of support for per-routine globals 2014-12-27 18:27:54 -08:00
Kartik K. Agaram
e9f916bb0a 448 2014-12-26 22:21:25 -08:00
Kartik K. Agaram
5c958813f9 447 - function invocations can share locals
This is the first step to creating closures. That requires specifying
the lexical scope 'frame' to read a variable from.
2014-12-26 22:03:19 -08:00
Kartik K. Agaram
19f02639b5 446
Clear up that ancient todo.

We don't particularly care about what abstraction we write tests at, as
long as we do so at *some* layer and document the intent. That lets us
move tests up or down in the future when we know more/have better taste.
2014-12-25 19:39:39 -08:00
Kartik K. Agaram
11d454a539 445 2014-12-25 19:21:01 -08:00
Kartik K. Agaram
9e15e4df4c 444 - bring back dispatch based on operand/result types
Was dropped in commit 149. But we need it for more convenient
overloading, especially now that the right way to build tagged-values is
unclear.

The original concern was that type/otype would make code harder to
'assemble' down to native. But we should be able to insert CALL
instructions to the right clause inside a function's code. So keep it
around in the toolbox.
2014-12-24 01:00:36 -08:00
Kartik K. Agaram
4630b4aee8 442 - string 'split' 2014-12-19 22:22:17 -08:00
Kartik K. Agaram
f45ea0cb5c 441 - string 'find-next' for characters 2014-12-19 19:03:35 -08:00
Kartik K. Agaram
63892e6e03 439 2014-12-17 23:11:51 -08:00
Kartik K. Agaram
420d3d420a 438 - unbelievable typo 2014-12-17 23:09:51 -08:00
Kartik K. Agaram
8360714552 436 - types* table can now contain integer-array:3, etc.
Biggest change was to the interface to the 'sizeof' helper. Where it
used to accept either a type symbol or a cons operand, it now always
accepts an operand, though the value of the operand can be _. In the
process the implementation is radically simpler.

Also reorg'd unit tests a little, putting those for 'deref' before
'sizeof'.

Finally, I'm giving in and enabling the printing of test names as
they're run. We still need this all the time in our surgery.
2014-12-17 14:08:30 -08:00
Kartik K. Agaram
a0bb6c0420 435 - starting to allow type definitions 2014-12-17 11:01:38 -08:00
Kartik K. Agaram
b93d2cd357 434 2014-12-17 10:52:54 -08:00
Kartik K. Agaram
68daae8c25 433 2014-12-17 10:47:04 -08:00
Kartik K. Agaram
4725111d23 431 - rename 'record' (struct) to 'and-record'
Now we can call unions 'or-record'.
2014-12-17 10:39:58 -08:00
Kartik K. Agaram
faad417b11 430 - cache common functions for tests
Tests now take 21s instead of 76s, reclaiming recent losses and more.
2014-12-15 02:00:18 -08:00
Kartik K. Agaram
6c8f19d2be 427 - ..and we're back. All mu.arc.t tests passing. 2014-12-14 12:41:03 -08:00
Kartik K. Agaram
f558373712 424 - layer 20 passing
Seemingly large diff but most changes are peephole.
2014-12-14 09:48:17 -08:00
Kartik K. Agaram
ad0bdc3e4f 422
Further cleanup of convert-names tests.
2014-12-14 08:29:27 -08:00
Kartik K. Agaram
0274f7d8ef 421 2014-12-14 08:14:13 -08:00
Kartik K. Agaram
640ddefe75 420 - no unnecessary structure in tests
It makes them harder to appreciate.
2014-12-14 08:11:39 -08:00
Kartik K. Agaram
b613977c76 419 - layer 11 now passing 2014-12-14 08:06:32 -08:00
Kartik K. Agaram
67737e857e 418 - more progress in layer 11
With the notion of layers we add the constraint of only being able to
formulate loop tests without 'run' -- otherwise they'd have to leave
layer 11 because they have so many more dependencies.

Might bring back the run-based tests afresh later. Especially since
loop-fail test is now totally gone.
2014-12-14 07:42:40 -08:00
Kartik K. Agaram
04c7870e59 417 - partially through layer 11 2014-12-14 07:38:14 -08:00
Kartik K. Agaram
64d5ef2d06 416 - renumber layers, but still passing until layer 10
$ arc load.arc 10 mu.arc.t
2014-12-13 23:31:52 -08:00
Kartik K. Agaram
431f8bcd3d 415 2014-12-13 23:26:15 -08:00
Kartik K. Agaram
a4929041e6 414 2014-12-13 15:02:04 -08:00
Kartik K. Agaram
ca7b3893e7 413 2014-12-13 14:51:58 -08:00
Kartik K. Agaram
f721fc48f8 412 - tests passing at level 10 2014-12-13 14:00:14 -08:00
Kartik K. Agaram
8aeb317f46 411 - 'tokenize-args' must handle blocks 2014-12-13 02:31:57 -08:00
Kartik K. Agaram
287c52140f 409 - new arg representation
Tests only passing at level 9:
  $ arc load.arc 9 mu.arc.t
2014-12-13 02:09:35 -08:00
Kartik K. Agaram
c7662ee7c5 408
Within a level we can now just rely on simple ordering.
2014-12-13 01:11:33 -08:00
Kartik K. Agaram
18b92d77c9 406 - mu tests run at level 10
We're now going to start doing surgery on low-level helpers.
2014-12-13 00:49:58 -08:00
Kartik K. Agaram
4f9f75ddcf 405 - permit loading just low levels of codebase
When I'm doing extensive surgery to the internals I want to avoid
loading higher levels; they aren't expected to work. But I don't want to
keep different levels in separate files just for that. And I definitely
don't want to put low-level stuff first. Now I can influence loading in
a cross-cutting manner by creating sections with numbers:

  (section 100
    ...code...)

And disabling them by running:

  $ ./anarki/arc 99 mu.arc.t

Currently we load all mu 'system software' in level 100, so running at
level 99 sidesteps them. Lower levels coming soon.

But most of the time we don't need to worry about levels, and the 'mu'
script lets us forget about them. Just run .mu files with:

  $ ./mu factorial.mu

To run tests:

  $ ./mu test mu.arc.t
2014-12-13 00:40:01 -08:00
Kartik K. Agaram
0ca35d02df 403 - 'function' is more clear than 'def' 2014-12-12 18:07:30 -08:00
Kartik K. Agaram
5b82e7075e 401 - stop abbreviating ops
We expect users to come across mu from arbitrary bits of code, so try to
make each line as self-contained as possible.
2014-12-12 17:54:31 -08:00
Kartik K. Agaram
18c794eb83 398 - new space for forked routines
Hack: currently restricted to 1000 locations per routine, no way to grow past that.
That suffices to pass our failing test.
2014-12-04 02:57:03 -08:00
Kartik K. Agaram
cf35ee38fc 397 - routines encapsulate allocator state
Still incomplete; one test temporarily disabled.
2014-12-04 02:50:33 -08:00