This is mostly boilerplate, mapping the following AST kinds: IfStatement,
ReturnStatement, ThrowStatement, Block, EmptyStatement, ExpressionStatement,
and LabeledStatement.
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.
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.
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.
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.
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.
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.
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...
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.
This change articulates Mu's packaging format, MuPack, along with its
corresponding intermediate language and type system, MuIL. This is very
much a work in progress.