Related articles |
---|
simple code translator - suggestions? makc.the.great@gmail.com (makc.the.great) (2005-06-02) |
Re: simple code translator - suggestions? haberg@math.su.se (2005-06-02) |
Re: simple code translator - suggestions? haberg@math.su.se (2005-06-04) |
Re: simple code translator - suggestions? cfc@shell01.TheWorld.com (Chris F Clark) (2005-06-06) |
Re: simple code translator - suggestions? haberg@math.su.se (2005-06-08) |
Re: simple code translator - suggestions? bettini@dsi.unifi.it (Lorenzo Bettini) (2005-06-08) |
Re: simple code translator - suggestions? codeworker@free.fr (=?iso-8859-1?q?C=E9dric_LEMAIRE?=) (2005-06-08) |
Re: simple code translator - suggestions? idbaxter@semdesigns.com (Ira Baxter) (2005-06-23) |
From: | haberg@math.su.se (Hans Aberg) |
Newsgroups: | comp.compilers |
Date: | 2 Jun 2005 15:01:43 -0400 |
Organization: | Mathematics |
References: | 05-06-004 |
Keywords: | translator, comment |
Posted-Date: | 02 Jun 2005 15:01:43 EDT |
<makc.the.great@gmail.com> wrote:
> In c++, sometimes I have to write code, that is C-like
....
> Anyway, back to point, I came to this thought. Why can't I have my C++
> code
....
> And then this file gets translated in pure c++ with translator in
> question. In some way, #define-s allow you do that, but their powers
> are limited. So, what would you suggest?
On a project, I exhausted the convenience of the C++ language, ending up
with repetitive class writing. The next logical step to me was to write my
own language, using Flex and Bison, to generate the C++ output, which then
can be compiled. This is not so complicated if the new language has an
option for verbatim inclusions of C++ code. The most complicated thing
with C++ is that stuff relating to the same symbol, like header,
declaration and definition will be written out in different locations,
like header and source file. But this can be automated by calling a
suitable program in the parser actions, able to sort it out. Perhaps
output can be generated by a macro program like say M4, but it may be
better to use Guile, in the output actions.
--
Hans Aberg
[I was also going to suggest M4. It's ugly, but often no more ugly
than the alternatives. -John]
Return to the
comp.compilers page.
Search the
comp.compilers archives again.