Mirah is mostly a pluggable compiler toolchain. The main elements of the chain are: • A
parser, based on JRuby's parser, that emits a Ruby
abstract syntax tree (AST) • A transformer that converts the Ruby AST into a Mirah AST • A type inferrer that decorates the Mirah AST with appropriate typing information for the target backend • A backend
code generator Of these phases, only the last two need specific knowledge of the eventual target platform. This makes Mirah suitable for many backends, and also makes it possible to write language
plug-ins for Mirah's transformation phase that will apply to all supported backends equally. For simple pieces of code and the JVM bytecode backend, the Mirah compiler emits nearly the same instructions as standard
javac compilers.
No runtime library Because Mirah is just a compiler, it ships no
standard library. The intent is that Mirah users will choose what libraries they want to use, perhaps write plugins for the Mirah compiler to support them, and the compiler will do the rest. This is an explicit design goal, avoid introducing a requirement on any new external library. The standard library for Mirah, then, is whatever the standard library for the current backend is, and emphasis is placed on writing compiler plugins rather than libraries to extend and enhance the language.
Type system Mirah does not impose a specific type system on users, instead relying on whatever the target backend provides. On the JVM, the type system is largely Java's type system, and type
declarations refer to JVM classes, primitives, and interfaces. Mirah is primarily a statically-typed language, but support is in development to allow dynamic typing also. The mechanism is similar to that provided in
C# 4, with a special
dynamic type indicating all dispatches against that
variable's value should be done dynamically. Dynamic type support is currently planned only for
Java 7 and higher, using the new invokedynamic bytecode. == Syntax ==