MirahFeatures

Mirah’s design is centered around a few simple principals:

  • Platform-agnostic

  • Free from concrete decisions about the back-end type system

  • Code generation, or other details are specified by the outward language

This means roughly similar scripts could conceivably compile to any number of type systems and runtimes. In this sense, Mirah is more of a rough coupling of Ruby-like syntax with a pluggable type-inference and compilation pipeline.

Mirah code has no runtime dependency other than libraries accessed directly from Mirah code.
No current JVM language addresses the aesthetic goals of Mirah without also introducing a runtime library, often of a prohibitive size.

Since Mirah contains no specific requirements on how code is to be executed, most Ruby syntax can be implemented on any platform using the execution primitives standard to that platform.

Every phase of the compilation pipeline should be pluggable, to the point that language enhancement becomes a simple matter of loading compiler plugins, rather than introducing syntax and libraries to support it (and the accompanying complexity and depenency hassle).

With these rough principals in mind, there are a few other general goals:

  • The compiler chain and plugins for it will be written in Ruby,
    though there’s no specific reason they could not be written in Mirah later on.

  • The syntax is largely Ruby-inspired
    (to the extent that the current Mirah implementation starts with an AST transformation from JRuby’s AST).

  • The type system is purely symbolic,
    with the compiler responsible for mapping symbolic types to a platform-appropriate representation.

  • A “fixnum” type may compile to int or Integer on JVM or any of the integer types for a C backend.

Because Ruby has a very flexible syntax already, syntax enhancements come in the form of special-casing method names, constant access, and the like to compile to keyword-like behaviors. As a result, the parser for Mirah is largely complete already, only AST (Abstract Syntax Tree) transformations are necessary to expand the language’s capabilities.

Type declarations should be minimized, but not necessarily eliminated. To support this goal, Mirah provides local type inference by the TheTyper, which provides the majority of the benefit of type inference without the much-higher complexity of full-system (e.g. Hindley-Milner) type inference.

In general, Mirah could be seen as a “Ruby with static types”, though Mirah is not Ruby. It does not share Ruby’s type system, core classes, standard library, or even execution model, since none of these things are imposed upon Mirah programs by the Mirah language.

Mirah is more a repurposing of Ruby’s syntax to a flexible toolchain suitable for compiling to any number of type systems and runtimes with maximum performance.