The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
0 votes
asked in Compiler Design by (21 points) | 75 views

Here is a concise and explanatory definition of what is a compiler.

1 Answer

+3 votes
Best answer
You write a C program to add two input numbers. Compile it and run - get the sum.

Now compiler comes in between here. What it does?

We are writing C code as per C syntax in English language. But the computer has a processor inside it where it takes instructions in machine language and the instructions should be of the form prescribed by the processor maker (Intel for example). These will be like

"MOV A, B;

So, the compiler does this job. It converts the source program written by a programmer in a high level language like C to the language the processor can understand- often called object file.

In the above example I used A and B which can be registers- which are memory locations fixed inside CPU. But these registers are limited and when we need more memory (say finding the sum of 100 elements) we use main memory (RAM) and then the address is used in then instruction - like 0x40000321  (of course converted to binary) instead of A. Then the CPU will call its address handler - in a VM system this will be converted to a physical address, and that returns/stores the content from/to that address. For this reason we study CO&A.
answered by Veteran (348k points)
selected by

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

34,234 questions
40,919 answers
39,834 users