Hey guys, I am making a simple c++ compiler with Visual Studio 2010, but I am stuck on the converting it to assembly bit(with c++ coding).

What I am trying to do is convert the code they type(in a cpp file) to assembly, then translate it to machine code etc.

I really need some help, I know how to get the tokens, but not how to convert it to assembly. Also while your at it, can you tell

me the libraries needed to make the exe.

PS. I have good experience with c++.

Thanks in return.

Recommended Answers

All 11 Replies

There are open-source compiler projects on codeplex and sourceforge and sites like that.

How good are you at assembly?
If your intermediate step is going to be ASM, is it good enough for you to then compile the ASM with something like a86 a86?
...or are you building the assembly compiler also?

Well I never really used assembly directly.

To me, ideas are fine

Hey guys, I am making a simple c++ compiler with Visual Studio 2010, but I am stuck on the converting it to assembly bit(with c++ coding).

The compiler will generate an assembly code listing for you. All you have to do is go to Projects --> Properties (at the bottom of the list) --> Configuration Properties --> c++ --> Output Files then change one of the options to whatever kind of listing you want.

Am I supposed to use #define?

I wanna use code because I an making a compiler from scratch

----Edit----
Anyone who wants to use assembly on Microsoft VC++ look at this

Oh... I get it now, I am supposed to parse then, look at the functions and actually convert it myself,
anyway, anyone know the library files needed to link?

What libraries to use depends on your program.

so... Like I am supposed use user32.lib etc. can you tell me for win32?

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.