M+ Interpreter

M+ is a lightweight script interpreter with a bunch of basic built-in mathematical functions. Since M+ is a procedural language there are no classes. A compilable unit consists at least of one main(…) function. You can interpret such a compilable unit as a standalone block of code with some arguments and a result value. You can use M+ to extend your Java2SE or Java2EE applications with a scripting core. This library is currently under development, use CVS to see the HEAD or the Demo Applet.

M+ also lets you instantiate any Java Class available on the classpath and supports auto-boxing with native datatypes. Your Java code can call M+ scripts and scripts can call Java objects. This project now consists of about 10.000 lines of code; nevertheless this project is at a pretty early stage of development and since it’s a part-time project it will take some time to find the right direction. There will be a lot of interesting aspects of compiler construction included in this work. Since I am very interested in the compiler world there will be activity as you can see in the CVS logs.

Short overview

  • Arithmetic expressions on native int,long,float,double,char,string,boolean
  • =, ++, –, +, -, *, /, &, |, ^, >>, <<, >>>
  • <, >, <=, >=, ==, !=
  • Autoboxing conversation
  • if/else, for, while, do/while, switch/case statements
  • Function overloading (partly)
  • Native Java object instantiation
  • 50+ built-in functions (math, time, println, …)
  • Redirect script output with trivial PrintStream


Source Code


  • Currently interpreting AST; generate Java Bytecode in future for faster execution speed.
  • Add language specific features like native hashmaps, native BigInteger support, and so on…
  • Find a new name for the language at a more final stage of development.

Schreibe einen Kommentar