• Advertisement
Sign in to follow this  

C compiler as back end

This topic is 2059 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
[quote name='zacaj' timestamp='1338411507' post='4944776']
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
[/quote]

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
[quote name='Zlodo' timestamp='1338461677' post='4944932']
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.
[/quote]

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