[antlr-interest] Antlr v4 - C++ target

Ivan Brezina ibre5041 at ibrezina.net
Tue Jan 24 03:46:34 PST 2012


Quoting Gokulakannan Somasundaram <gokul007 at gmail.com>:

>>
>> Don't use templates.
>>
>> Sigh.
>>
>> Jim
>>
>> Jim,
>     Have you had a look at Boost spirit parser? They have done the entire
> thing with templates. I am only doing the runtime with templates. If you
> are concerned with the compile time performance, i am assuring you that i
> will limit the use of template not to stress the compiler.
>      If there is something very obvious that i am missing, please let me
> know.
>
> Thanks,
> Gokul.
>

Hi,
I've been using spirit for about a year. Both versions "1" and "2".
During that time I reported two bugs in gcc and then finally I moved
to ANTLR.

Templates are nice, but on the other hand they must not be overused.
Templates are "equal" or transformable onto recursively enumerable functions
so theoretically you can perform any kind computation at compile time and then
you can store the result in the "final" program. The efficiency of  
such a program
is usually very poor. Every compiler has it's own limitations.
For example when using MSVC you can have max. 2048 nested template  
specializations.
This implies max. depth for the recursive function.

When using spirit I ended up in a situation that my grammar could not  
be compiled at all
using MSVC. While gcc had exponential memory requirements per  
grammar's rule length.

The approach boots uses is not applicable for complex grammars. The  
rest of the boost
library like functors, binds ... etc are very useful.

Ivan



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



More information about the antlr-interest mailing list