Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

C compiler as back end

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
4 replies to this topic

#1 Dawoodoz   Members   

459
Like
0Likes
Like

Posted 30 May 2012 - 02:27 PM

I want to make a compiler that parse my own language and returns C code to a lower compiler. The problem is that every free C/C++ compiler that I have tried takes around 100 megabytes with all it's dependencies. Is there any free lighweight C compiler for Windows that was made to be used as a back end?

"App". is an acronym and must always be followed by a dot.

https://en.oxforddictionaries.com/punctuation/punctuation-in-abbreviations


#2 zacaj   Members   

663
Like
1Likes
Like

Posted 30 May 2012 - 02:58 PM

www.tinycc.org is extremely small: it can compile code at run time even. However I don't think it includes any of the C headers, which are probably what are using most of your space in the first place

#3 Dawoodoz   Members   

459
Like
0Likes
Like

Posted 30 May 2012 - 03:32 PM

www.tinycc.org is extremely small: it can compile code at run time even. However I don't think it includes any of the C headers, which are probably what are using most of your space in the first place


Nice, I don't even have to compile it using another compiler. :)

"App". is an acronym and must always be followed by a dot.

https://en.oxforddictionaries.com/punctuation/punctuation-in-abbreviations


#4 Zlodo   Members   

646
Like
0Likes
Like

Posted 31 May 2012 - 04:54 AM

Have you considered using llvm? Generating llvm "assembly code" is pretty easy (as it abstracts away the really annoying stuff like register allocation), you can get llvm to compile it as native code or to JIT it, it can optimize it as good as the best compilers out there, or as little as you want if you prefer the compilation process to be very light and fast, and I doubt that including only the llvm libraries + the target specific back end is that big.

LLVM is pretty much designed for the very purpose of handling your type of use case.

#5 Dawoodoz   Members   

459
Like
0Likes
Like

Posted 31 May 2012 - 01:27 PM

Have you considered using llvm? Generating llvm "assembly code" is pretty easy (as it abstracts away the really annoying stuff like register allocation), you can get llvm to compile it as native code or to JIT it, it can optimize it as good as the best compilers out there, or as little as you want if you prefer the compilation process to be very light and fast, and I doubt that including only the llvm libraries + the target specific back end is that big.

LLVM is pretty much designed for the very purpose of handling your type of use case.


I plan to use my front end compiler in Visual Studio projects so that I can use it together with C++. The C compiler will just make it complete for module testing.

"App". is an acronym and must always be followed by a dot.

https://en.oxforddictionaries.com/punctuation/punctuation-in-abbreviations





Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.