[antlr-interest] More, Status of C++ backend?

Ruslan Zasukhin sunshine at public.kherson.ua
Tue Jan 1 09:15:56 PST 2008


On 30/10/07 6:47 PM, "Jim Idle" <jimi at temporal-wave.com> wrote:

> I have made a tentative start now, but I have been busy working for a while
> unfortunately. I hope to be back on it next week sometime. The C target has
> worked fine for most people that initially wanted C++ back ends, though
> eventually it will be better to have C++ based actions of course.

Hi Jim,

Once I again I want repeat this question :-)

1) we have few year ago made SQL grammar for ANTLR 2.7.2 made with C++
target.

So I wonder, how easy will be port this to C target.
And what you mean with
>    eventually it will be better to have C++ based actions of course".

You mean now in C target we cannot have actions as

    {
        MyClass * p = new MyClass()
        i.e. Some C++ code
    }

?


2) also I have come to all these issues because again did profile of 100K-1M
INSERTS, and I see big troubles in ANTLR 2.7.2 C++ runtime. As far as I
could see problem come from LA() which calls a lots NextToken() which
creates std::string() what cause call of new() (and later free.

ANTLR parser looks to work 8-10 times slower of YACC or Lemon. And I think
because of this reason.

I have check -- and it seems to be deal of few hard days work to try remove
std::string from C++ runtime of ANTLR 2.7.2 and using instead just
    pair  { char*, length }
    where char* points right into string we do parse.
    I do not see any need today do COPY of each token string.
    btw, how you have implement this in C runtime for v3 ?

Before to do this I was going to check state of deal in ANTLR 3,
and I see that C++ runtime even not exists.

My advice will be not use std::string at all, and do not make not required
copies of strings into each Token object.


-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the antlr-interest mailing list