[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Can be extended for C++?

From: Bernhard Fischer
Subject: Re: [Tinycc-devel] Can be extended for C++?
Date: Mon, 15 Oct 2007 16:50:38 +0200
User-agent: Mutt/1.5.16 (2007-06-11)

On Mon, Oct 15, 2007 at 07:20:39AM -0700, Chris Lattner wrote:
> On Oct 15, 2007, at 2:59 AM, Ivo wrote:
>> On Monday 15 October 2007 11:31, Sanghyeon Seo wrote:
>>> 2007/10/15, ShangHongzhang 62185 <address@hidden>:
>>>> Is it possible to extend the TCC for supporting C++ syntax parsing?
>>>> I think it must be very hard to do so, isn't it?
>>> I think it would be impossibly hard to do so.
>> Yes. The code generator is intertwined with the parser. Also, I seem to
>> remember reading somewhere that a single pass C++ compiler is impossible
>> due to the nature of the language. tcc is a single pass compiler.
>> Perhaps you could put a C++-to-C compiler in front of tcc. Such code can
>> still be found on the net. IIRC the very first C++ implementation was done
>> like that (cfront plus a normal C-compiler). Later on, certain
>> C++ "features" were nearly impossible to translate and they moved on to a
>> dedicated C++ compiler. Perhaps "they" have overcome these problems 
>> because
>> LLVM is able to generate C from C++.
> Converting C++ to C is just as hard as parsing C++ in the first place.  
> Also (FWIW) the LLVM C++ to C support does not produce "human readable" C 
> code, it produces really ugly low-level C code that uses gotos etc.  It 
> also depends on llvm-gcc.
> You might be interested in http://clang.llvm.org though, which does not 
> depend on GCC at all.  But its C++ support is just starting.

And if you're just interrested in a C++ parser, then i would point at
boost::wave (didn't look if clang uses wave or not, i'd guess it

reply via email to

[Prev in Thread] Current Thread [Next in Thread]