Jump to content
  • Advertisement
Sign in to follow this  
Dawoodoz

C compiler as back end

This topic is 2239 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites

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. :)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!