Click here to Skip to main content
16,016,759 members
Articles / Programming Languages / C++
Article

C to Assembly Cross-compiler

Rate me:
Please Sign up or sign in to vote.
3.17/5 (33 votes)
4 Mar 2004 75.3K   4.5K   22   11
An example cross-compiler program with full source code

Introduction

C2ASM is a cross compiler and it converts "C" code into "ASSEMBLY" code. It uses a subset of "C" language. It is written as a console mode application. If you want to read more about C2ASM, download the documentation provided with the article in an RTF file. You may also download the source code and also sample input programs in "C".

It uses no Object Code Optimizations or Register Allocation Algorithms. It's a very simple cross compiler. I made it as my semester project for learning purposes only. At the time I was making it, I got no help on how to create Intermediate Code and to do Code Generation. So, I submit this here and hope that my C2ASM project may help other beginner Compiler Writers to get an idea on how to make a complete working compiler from start to finish. Thanks for any feedback that you might have for me.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Pakistan Pakistan
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
Generalcross compiling Pin
nanlu28-May-09 0:22
nanlu28-May-09 0:22 
Questionmore Pin
kye4kye29-Mar-07 3:28
kye4kye29-Mar-07 3:28 
Questionhi Pin
Grkem17-Mar-07 13:58
Grkem17-Mar-07 13:58 
QuestionQuestion!!! Pin
Pankaj Paul13-Mar-07 1:48
Pankaj Paul13-Mar-07 1:48 
Is it possible to transfer any c program to its assembly code by your program?
Generaldisapointed Pin
toxcct6-Oct-04 7:10
toxcct6-Oct-04 7:10 
GeneralRe: disapointed Pin
gwapo14-Jun-06 22:54
gwapo14-Jun-06 22:54 
GeneralNice Pin
Alexander M.,7-Mar-04 2:58
Alexander M.,7-Mar-04 2:58 
GeneralI use Pin
NormDroid6-Mar-04 6:01
professionalNormDroid6-Mar-04 6:01 
GeneralHmm Pin
Wes Aday5-Mar-04 5:24
professionalWes Aday5-Mar-04 5:24 
GeneralSo... Pin
Jörgen Sigvardsson5-Mar-04 5:04
Jörgen Sigvardsson5-Mar-04 5:04 
GeneralRe: So... [EDITED] Pin
John M. Drescher5-Mar-04 13:43
John M. Drescher5-Mar-04 13:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.