I'm writing a compiler, but if I want it to be on more than one platform, it seems I have to learn every assembly language for the different platforms. I've seen a number of languages which try to be 'portable assembly languages' such as Linolium and C--, but they all seem to be incomplete or abandoned.

Is there any such language which can be used as a compiler back-end language?

If this is a stupid question for any reason, please say so, as I am new to writing compilers/interpreters.

--PieSquared

I'm writing a compiler, but if I want it to be on more than one platform, it seems I have to learn every assembly language for the different platforms. I've seen a number of languages which try to be 'portable assembly languages' such as Linolium and C--, but they all seem to be incomplete or abandoned.

Yes, people try these ideas but they tend to go nowhere because this approach works against itself. Assembly is the language that the CPU understands ... therefore it is a highly hardware dependent language and this is where all the benefits come from -- take away this "close bond with the hardware" and you will loose all of the benefits. This is why C is still widely used today -- it is as close as one can get to ASM and still be portable.

Is there any such language which can be used as a compiler back-end language?

Actually, the Java byte-code runs on a virtual machine (VM) and so does the MSIL for .NET (and mono) -- of course, this is managed code (runs in a "sandbox") but either of these could function as a 'portable assembly-like language' to be used as a compiler back-end.

Nathan.

That answered my question, thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.