Re: How far will C/C++ get me as an intermediate form for my language?

"tuxisthebirdforme@gmail.com" <tuxisthebirdforme@gmail.com>
Sat, 15 Nov 2008 09:42:01 -0800 (PST)

          From comp.compilers

Related articles
How far will C/C++ get me as an intermediate form for my language? tony@my.net (Tony) (2008-10-31)
Re: How far will C/C++ get me as an intermediate form for my language? tuxisthebirdforme@gmail.com (tuxisthebirdforme@gmail.com) (2008-11-15)
| List of all articles for this month |
From: "tuxisthebirdforme@gmail.com" <tuxisthebirdforme@gmail.com>
Newsgroups: comp.compilers
Date: Sat, 15 Nov 2008 09:42:01 -0800 (PST)
Organization: Compilers Central
References: 08-11-002
Keywords: code
Posted-Date: 15 Nov 2008 18:30:50 EST

I think starting with C or even C++ as an intermediate form is a great
idea. Most c/c++ compilers today can optimize the heck out of any
code you write, as long as you at least try to give it something
decent to start with. If you want garbage collection in your language
(many languages are becoming that way) you'll want to make sure to
take care of that in you're output code. Another nice feature of
using c/c++ as IR is that it's probably about the closest you can get
to machine code without losing portability, that is, if you want to be
able to generate/optimize programs for other architectures, too.
About the destructor in your example above: if you implemented your
compiler to output in c++ and then compiled that, you wouldn't have to
take care of calling the destructor (c++ compiler will do it for you)
unless you really wanted to. In that case, just call the code before
the last brace. Another suggestion: if you're not already, use gcc (g
++) as your back-end compiler. It's free and compatible across many
systems even on the same architecture. Good luck. I'd be interested
in knowing how it works out for you.



Post a followup to this message

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