[antlr-interest] Mantra language overhaul / reimplementation
Terence Parr
parrt at cs.usfca.edu
Sat Sep 22 16:58:56 PDT 2007
On Sep 22, 2007, at 4:53 PM, Sohail Somani wrote:
> On 22/09/07 04:48 PM, Terence Parr wrote:
>> Howdy. I am almost done with a sprint to build a decent Mantra
>> language:
>>
>> http://www.linguamantra.org/
> Hi,
>
> I think a decent reference language for use with antlr will be very
> helpful! What kind of optimizations do you do?
At this point, I'm simply trying to avoid general message sentence
that call an invoke() method with the name of the message. These are
expensive because they must look up the method in a hash table. If I
know the type of the variable o, then o.foo() can be generated as
((thetype)o).foo()
even though o is declared as a simple mantra object. The type
information is enough to let the Java compiler do a direct call
without any kind of weird hash table lookup.
A similar thing happens for fields. o.f can be converted to
((thetype)o).f rather than a general setter or getter method.
:)
Naturally a lint like program could give you some information like
what they static compiler would give you.
I'm adding a few more optimizations and hoping to get a graduate
student involved in building up the runtime library. Usually the
library methods are simply things veneers over the Java libraries,
they'll help to clean them up quite a bit. Soon I should be ready to
release something. The translator is remarkably small.
What you think of the syntax?
Ter
More information about the antlr-interest
mailing list