simple code translator - suggestions?

"makc.the.great" <makc.the.great@gmail.com>
2 Jun 2005 01:01:39 -0400

          From comp.compilers

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)
[1 later articles]
| List of all articles for this month |

From: "makc.the.great" <makc.the.great@gmail.com>
Newsgroups: comp.compilers
Date: 2 Jun 2005 01:01:39 -0400
Organization: http://groups.google.com
Keywords: translator, C++, question
Posted-Date: 02 Jun 2005 01:01:39 EDT

In c++, sometimes I have to write code, that is C-like - in a way that
it operates with classes like if the were complex data types; sometimes
I even re-implement methods as operators to facilitate coding. but, it
is quite annoying to write NSpace::Class1 *p = (std::nothrow)
NSpace::Class1 (...); ((NSpace::Class2)(*p->SomeProp)).Method(...) I
mean in JavaScript, for example, with its always-dot syntax things are
plain and simple, even if you manipulate ActiveX object...


Anyway, back to point, I came to this thought. Why can't I have my C++
code in the form:


some-token
    script-to-cpp-mapping-declarations
some-token-2-switch-2-cpp-code
    /* c++ code here */
some-token-2-switch-2-script-code
    /* code written in simple dot-syntax script */
some-token-2-switch-2-cpp-code
    /* c++ code here, if really necessary */
some-token-2-switch-2-script-code
    /* more code written in simple dot-syntax script */
....


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?


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.