Commit graph

5244 commits

Author SHA1 Message Date
joeduffy 92dd19d98a Add new AST node types to MuPack doc 2017-01-03 04:14:56 -08:00
joeduffy f2e70c6222 Map binary operators during lowering 2017-01-03 04:14:37 -08:00
joeduffy 2d5a81e350 Add a note about the need to figure out string functions 2017-01-03 03:56:15 -08:00
joeduffy 0979c0c165 Add IsInst and TypeOf expressions
This adds two expressions we will need to support many type test patterns.

IsInst simply checks an expression for castability to a target type; it evaluates
to a boolean.

TypeOf fetches the runtime type of a given expression and evaluates to its name.
Right now, this is just a string token, rather than some richer RTTI object.
2017-01-03 03:48:28 -08:00
joeduffy bebc952998 Add a note on dependency pinning 2017-01-03 03:41:41 -08:00
joeduffy ca124ea3a6 Add more AST lowerings for trivial kinds
This includes AST lowering for DebuggerStatements and ConditionalExpressions,
both of which are straightforward boilerplate mappings.
2017-01-02 16:44:51 -08:00
joeduffy e8e031f97c Map a few more trivial AST kinds
This is mostly boilerplate, mapping the following AST kinds: IfStatement,
ReturnStatement, ThrowStatement, Block, EmptyStatement, ExpressionStatement,
and LabeledStatement.
2017-01-02 16:33:31 -08:00
joeduffy 25c321e5f6 Fix a few random typos I noticed 2017-01-02 16:26:19 -08:00
joeduffy 41323c1dc7 Reorder some things 2017-01-01 18:34:31 -08:00
joeduffy c403f9b444 Nit, shorten the ridiculously lengthy title 2017-01-01 18:33:28 -08:00
joeduffy 17a0f62f8d Add a few tidbits, include an AST shape snapshot in MuIL section 2017-01-01 18:29:07 -08:00
joeduffy 78b2adc9fe Overhaul the stacks.md design document
The stacks.md document used to describe the metadata format.  Now that we've
moved away from the old model of YAML + Go templates, and created the MuPack/MuIL
format, this document needed to be overhauled.

It's pretty bare bones now, however it will eventually evolve into a document
describing how the Mu abstractions map down onto MuPack/MuIL concepts.  For example,
it describes how subclassing mu.Stack creates a "stack", even though at the MuPack/MuIL
level it's just any old subclass.
2017-01-01 18:06:03 -08:00
joeduffy 36ab7a8710 Add some out of date markers 2017-01-01 17:11:28 -08:00
joeduffy 0c2940ba0b Goodbye Mull2
Some say the world will end in fire,
Some say in ice.
From what I've tasted of desire
I hold with those who favor fire.
But if it had to perish twice,
I think I know enough of hate
To say that for destruction ice
Is also great
And would suffice.
2017-01-01 17:05:48 -08:00
joeduffy e451d64a71 Tidy up a few things, especially references to "resources" 2017-01-01 16:57:12 -08:00
joeduffy a2ca2c84af Flesh out the cross-cloud doc 2017-01-01 16:35:23 -08:00
joeduffy 7a502cb83a Flesh out a bunch of things 2017-01-01 16:17:30 -08:00
joeduffy 7d249894ee Freshen up the description of dependency management 2017-01-01 16:02:18 -08:00
joeduffy 1895753f53 Goodbye Mull
A Death blow is a Life blow to Some
Who till they died, did not alive become--
Who had they lived, had died but when
They died, Vitality begun.
2017-01-01 15:24:25 -08:00
joeduffy 67ca1a6cc4 Add a README pointer to the overview doc 2017-01-01 15:19:22 -08:00
joeduffy 1bd1aaf968 Reorganize documents a bit and add an index 2017-01-01 15:18:36 -08:00
joeduffy 8f820ce11f Rename languages.md to formats.md
And also wordsmith a bunch of the front matter.
2017-01-01 15:12:51 -08:00
joeduffy f42e2579f4 Bring the concepts section up to date 2017-01-01 14:39:26 -08:00
joeduffy d4d6f3e018 Update the targets table 2017-01-01 14:24:08 -08:00
joeduffy a1d21b0d73 Move most docs into a design subdirectory 2017-01-01 14:18:00 -08:00
joeduffy 1ffb120bb3 Add a placeholder for competetive landscape in overview doc 2017-01-01 14:17:36 -08:00
joeduffy 82135ab219 Add a paragraph about interpretation 2017-01-01 14:17:08 -08:00
joeduffy 36534145a5 Rename architecture.md to overview.md
...and also add some front matter about the Mu problem and solution statements.
2017-01-01 14:13:25 -08:00
joeduffy ca7023602a Make a few nit/todo/wordsmithing edits 2017-01-01 12:58:40 -08:00
joeduffy 9089718fcf Add some simple control flow transformations
This includes break, continue, and while, which are trivial.  It also
includes do/while, which requires a simple rewrite during the lowering,
since MuIL only supports the one simple kind of loop.
2016-12-31 14:53:37 -08:00
joeduffy 2c7bbde93f Add an Identifier node kind 2016-12-31 14:18:55 -08:00
joeduffy ba11d87704 Add transformations for literal expressions 2016-12-31 14:13:45 -08:00
joeduffy 864e02fb32 Add basic TypeScript AST transform traversal
This change mostly adds the scaffolding to be later filled in to perform
TypeScript AST lowering into the MuIL and MuPack formats.
2016-12-31 13:29:46 -08:00
joeduffy ce3f3b9469 Add a few missing statement kinds
This adds a few missing statement AST kinds:

* ReturnStatement to `return` from a function with an optional expression.

* ThrowStatement to `throw` an exception object.

* EmptyStatement to represent, well, a statement without anything to it.
2016-12-31 13:21:06 -08:00
joeduffy ad239d1cdf Fix some TSLint and compiler warnings 2016-12-31 12:33:10 -08:00
joeduffy 7fcb195366 Refactor and rearrange modules a bit
This change refactors a few things:

* Eliminate the `mujs.il` package; instead, introduce `mujs.ast`.

* Split `mujs.ast` into many different files, to organize things a
  little more cleanly into expressions, nodes, sources, and statements.

* Move most definitions from the `mujs.pack` package into `mujs.ast`,
  into the definitions file.  This ensures that all definitions are true
  AST nodes, meaning they will preserve source location information.
2016-12-31 12:22:22 -08:00
joeduffy 4de470af46 Add a compiler module
This change adds a simple compiler module that hosts TypeScript and
compiles a program.  The compile function takes a path and optional options
data structure; the path can be one of three things: 1) a path to a single `*.ts`
file, in which case it, and it alone, is compiled; 2) a path to a `tsconfig.json`
file, in which case it is loaded, parsed, and used to drive compilation just
like the `tsc` command line driver; or 3) a path to a directory containing a
`tsconfig.json` file, in which case it is discovered and used just like #2.

There is also a new command line driver that just blindly passes arguments to
this compiler API, and prints the results.  Next up, this will begin lowering and
transforming the resulting TypeScript AST to MuPack and MuIL.

Note that I've reorganized the source code slightly, so that instead of just
`src/*`, we now have `lib/*` for the library, `cmd/*` for any CLI drivers, and,
soon, `test/*` for test cases.
2016-12-31 11:23:20 -08:00
joeduffy 366648d1d4 Upgrade to latest TSLint, and compile cleanly 2016-12-31 11:16:36 -08:00
joeduffy a07a81f7dc Add a LabeledStatement for labeled jumps 2016-12-31 10:37:21 -08:00
joeduffy cf271bc2ac Change dynamic load key to expression
This needs to be a string-typed expression, but needn't be a literal.
2016-12-31 10:36:34 -08:00
joeduffy a2c376b9ed Implement the MuIL AST
This is an initial implementation of the MuIL AST.

The AST has been intentionally pared back to the bare essentials, leaving the
task of lowering to the higher level MetaMu compilers.  For example, there is
only a single conditional statement, a single looping construct, etc.

It is in the MuJS compiler package so that we can begin lowering TypeScript
ASTs to this format and serializing them.  We will need separate Go projections
of these shapes in order to deserialize and evaluate programs to produce MuGL
from within the runtime/evaluation engine.

I'm sure the shape of these things will need to change -- and there are a
handful of open questions -- however, this is a start...
2016-12-30 15:34:49 -08:00
joeduffy a8ea444a68 Add typed projections for package metadata 2016-12-30 11:40:54 -08:00
joeduffy 88b06e0816 Add a note on exceptions 2016-12-30 11:04:23 -08:00
joeduffy 55a2a2abce Articulate accessibility 2016-12-30 10:34:55 -08:00
joeduffy 5de6b89562 Give in to classical classes
This change adopts some standard aspects of classes, like statics, abstract,
and virtuals (sealing).  It also recognizes records and interfaces as explicit
annotations on classes (both of which can be called "conjurable"); they were
already being treated specially with respect to structural/duck conversions,
and I always hate inferring defining properties of types like this, since simple
edits can completely change the type's semantics and break consumers of it.
2016-12-30 09:48:32 -08:00
joeduffy 88a550f420 Make a statement about async/await 2016-12-29 21:07:48 -08:00
joeduffy b88ed913cc Whittle away at the open issues list 2016-12-29 18:19:38 -08:00
joeduffy cf432e2a8a Add overview of function types and conversions 2016-12-29 18:08:19 -08:00
joeduffy 056ba1acf9 Move away from records, embrace classes
Also add a section on primary properties and initialization.
2016-12-29 16:25:26 -08:00
joeduffy e130b157aa Add details on variables and functions 2016-12-29 15:27:52 -08:00