C compiler and interpreter

Status
Not open for further replies.

lcs81

Member level 3
Joined
Aug 2, 2005
Messages
57
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,683
What is the diffrent between compiler and interpreter?


Can we write our own interpreter or compiler?


I am a bit confuse with compiler. Is the sofware C program come with few copiler so that our program is compile into few machine code or just compile to the machine that we are using?
 

basically the work of a compiler or interpreter is to convert high level language into machine language and execute it

in a compiler, the entire program is compiled first and then the whole program is executed

whereas in an interpreter, a single line (instruction) is compiled and executed and then the next line (instruction) is compiled....and so on
 

    lcs81

    Points: 2
    Helpful Answer Positive Rating
Although C code could be compiled to many specific machines without or with minor modifications, the compiler must set one specific target when doing the compiling. It could not just compile once and the code could be run on every machine. The C code is portable not the compiled result. Unlike Java which use intermediate Virtual Machine between its compiled byte code and the real machine, so Java could compiled once and run anywhere or so it said
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…