[antlr-interest] Mantra language overhaul / reimplementation

Terence Parr parrt at cs.usfca.edu
Sat Sep 22 16:48:17 PDT 2007


Howdy.  I am almost done with a sprint to build a decent Mantra  
language:

http://www.linguamantra.org/

I have just added type annotations that make the code more readable  
and to support heavy optimizations.  It is still a dynamically typed  
language like Ruby and Python, however.  You will find type  
annotations and interesting compromise between statically and  
dynamically typed languages.  You might also find the pipeline  
oriented programming (POP?) quite interesting.  You can create new  
functionality by piping actors together rather than adding methods to  
classes. For example, imagine providing a facility for converting a  
file to a stream of lines. The traditional way is to create a lines()  
method in File and then call f.lines(). You could also add f.words()  
and so on. But, the exact same functionality is useful for strings  
and any other stream of characters.  Pipelines offer a better  
solution. Create a single input/output processor (an actor) and then  
pipe an input source to the actor.

I was not going to release the software until after my students had  
had a chance to implement it next semester, but it has evolved way  
beyond a student project.   This mantra implementation should prove  
useful to those trying to implement their own languages and might  
also be a good research platform for those wanting to experiment. The  
one issue I have is that I fixed a number of bugs in ANTLR 3 that  
this language relies upon. I think I might be able to an interim  
release for ANTLR simultaneously.

Ter


More information about the antlr-interest mailing list