flat assembler
Message board for the users of flat assembler.

flat assembler > Projects and Ideas > C++ Compiler in assembly

Author
Thread Post new topic Reply to topic
connor



Joined: 07 Jun 2016
Posts: 38
Location: sj ca
I'm thinking if there is a C++ Compiler written in assembly language somewhere ?

never-mind its limitations; easy to take care of.

_________________
9518741
Post 18 Jun 2018, 05:08
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15976
Location: Qo'noS
There might be one somewhere but it is doubtful. Most C++ programmers would like their compiler to be able to compiler itself. And it would also lose the advantage of cross-platform-ness.

But what you could do is take an existing C++ compiler and capture the assembly output of it compiling itself. Then you wold have an assembly version of a C++ compiler. The output would likely be quite ugly from a readability POV.
Post 18 Jun 2018, 08:40
View user's profile Send private message Visit poster's website Reply with quote
connor



Joined: 07 Jun 2016
Posts: 38
Location: sj ca
"take an existing C++ compiler and capture the assembly output of it compiling itself"

How do I set that up & with what?

;I want to try it in windows. and save the output as an asm.
Post 08 Jul 2018, 05:07
View user's profile Send private message Reply with quote
ManOfSteel



Joined: 02 Feb 2005
Posts: 1147
Compilers first generate a low-level version of the code before assembling it into the final product. Some compilers provide a switch for that. GCC and Clang have the -S switch (cc -S test.c -o test for the default AT&T syntax or cc -S -mllvm --x86-asm-syntax=intel test.c -o test (-masm=intel for GCC) if you prefer Intel syntax).

Of course don't expect the output code to look very pretty.

I'm not sure this method will be useful at all with such beasts as modern high-level compilers though.
Post 08 Jul 2018, 09:04
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2018, Tomasz Grysztar.

Powered by rwasa.