David Brown wrote:
On 11/06/2012 09:45, Chris Jones wrote:
Is it possible to modify the source code of gcc to enable to compilation
of a completely new programming language, as yet unrecognized? How much
of a big job would I be looking at for such a task?
I would think that would depend entirely on the language you want to
implement. If your language has similar principles to existing gcc
languages, then most of the middle-end and back-end could be left
untouched. But if it has major differences, you might need to change
gcc in all sorts of difficult places.
I guess the best guide here would be to look at the integration of Go
into gcc - I believe it is the most recent addition to gcc.
You could also consider a stepping stone of making a translator
between your new language and C (or C++, D, Go, etc.), then using gcc
to compile the C code. It is not going to be optimal, but it could be
useful in developing your language, testing the concepts, developing
the libraries, etc. And it will also help answer your question - if
you can make a reasonably efficient translator to C (using any gcc
extensions as needed), then you can expect a reasonably
straightforward job in writing a gcc front-end to the language. But
if you find concepts that are particularly alien to C, then you are
going to have a bigger job writing a gcc front-end.
So it seems I have two options really. Use a translator to implement my
language with gcc. Or I could develop a new front-end for it to
integrate it into gcc. Am I right?
Also, my new language is completely written from scratch and is nothing
like any other language currently available.
http://simpledictionarylanguage.weebly.com
It's currently in very early stages and is not yet anything workable,
but development is coming along nicely. But I need to know how I'm gonna
compile the eventual code with gcc before I get myself in too deep. At
least now in the early stages, I can change my development path pretty
easily.
Regards
--
Chris Jones
OpenSUSE Linux x86_64 (PC)|Android (Smartphone)|Windows 7 (Laptop)|Windows XP
(Gaming)
Kernel developer|Lead Developer of SDL|Lead Developer of Nest Linux|Gamer and
Emulator nut|Web Services|Digital Imaging Services
Controllers: Rapier V2 Gaming mouse|Logitech Precision|PS3 controller|XB360
controller|Logitech Attack 3 j/stick
Emulators: Fusion|Gens|ZSNES|Project64|PCSX-R|Stella|WinVICE|WinUAE