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 <[EMAIL PROTECTED]>:
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.
-Chris
_______________________________________________
Tinycc-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/tinycc-devel