top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration
Print Preview

How a compiler works?

+1 vote
43 views

In general, how a C language written program is converted into a binary by a C compiler ?

posted Aug 31, 2013 by Vikram Singh

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

0 votes

This is how a compiler works -

Lexing - break up the text of the program into "tokens"
Parsing - convert the sequence of tokens into a parse tree, which is a data structure representing various language constructs: type declarations, variable declarations, function definitions, loops, conditionals, expressions, etc.
Optimization - evaluate constant expressions, optimize away unused variables or unreachable code, unroll loops if possible, etc.
Translate the parse tree into machine instructions (or JVM byte code)

answer Aug 31, 2013 by Salil Agrawal
Similar Questions
0 votes

I am looking for detailed description of optimization flags that are provided by GCC compiler ?

+2 votes

I need to use microhttpd.a and pthread.a to build a cross-compiled program to be deployed on an arm-linux-gnueabihf device.

Where can I find instructions on how to do this? Or, is this simply a matter of downloading the source code and compiling (on a 64 bit UbuntuPC) to a library with my existing gcc-arm-linux-gnueabihf-4.8 cross-compiler?

While I may be able to find microhttpd.a and pthread.a binaries for an arm-linux-gnueabihf device, they will likely have been built with a different version of gcc-arm-linux-gnueabihf, which, I fear, could open up a can of worms.

+2 votes

What steps are performed by a compiler and how many types of compilers are present and used frequently ?


Useful Links with Similar Problem
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#470/147, 3rd Floor, 5th Main,
HSR Layout Sector 7,
Bangalore - 560102,
Karnataka INDIA.
QUERY HOME
...