Monty is a class-based, object-oriented language. Classes,
variables and functions are objects. In this way, functions can be
used as parameters and return values. This feature can often be found
in scripting languages, but not in classic programming languages.
As a basic principle every object is defined at any time. Values like
nil
, null
or None
do not exist.
This decision is based upon
Tony Hoare's
statement on his "Billion Dollar Mistake" regarding null
references.
The fundament of the language is a static type system which is well known from classic programming languages like C++ or Java. Static typing has a positive effect on the runtime performance of a programming language. Due to abstract classes and a new operator which allows the extension of objects at runtime, we provide flexible typing mechanisms and improve the development comfort.
The syntax is designed as compact as possible, while being as readable
as possible. On this account we refrain from using the well known
access modifiers public, protected and
private and instead use the UML notation for
attribute visibility. Also instead of using curly braces to signalize
blocks, we use indentation to bring structure into the code (as it is
also done in Python).
The assignment operator in Monty is not just an equals
=
symbol, but the mathematically more correct notation
:=
.
You can find the language specification at our downloads page.
The Monty compiler is entirely developed in Java. We use the parser generator ANTLR to generate the syntax analysis from the grammar. The context analysis and code generation are implemented in Java, using the design patterns prescribed by ANTLR. The output of the code generation is machine code for the compiler infrastructure LLVM 2. This machine code is then either interpreted by the Low Level Virtual Machine (LLVM) or compiled to machine code of the target architecture.