recategorized by
1,299 views

2 Answers

0 votes
0 votes
option C

compiler take High level language as input

and convert it to Assembly language

assembler take the assembly program and convert it to object code
0 votes
0 votes

Compiling a C program is a multi-stage process. At an overview level, the process can be split into four separate stages: Preprocessingcompilationassembly, and linking.

preprocessing

The first stage of compilation is called preprocessing. In this stage, lines starting with a # character are interpreted by the preprocessor as preprocessor commands. These commands form a simple macro language with its own syntax and semantics. This language is used to reduce repetition in source code by providing functionality to inline files, define macros and to conditionally omit code.

This is the first phase through which source code is passed. This phase include:

  • Removal of Comments
  • Expansion of Macros
  • Expansion of the included files.

The preprocessed output is stored in the filename.i.

compilation

The next step is to compile filename.i and produce an; intermediate compiled output file filename.s. In this stage, the preprocessed code is translated to assembly instructions specific to the target processor architecture. These form an intermediate human readable language.

The existence of this step allows for C code to contain inline assembly instructions and for different assemblers to be used.

assembly

During the assembly stage, an assembler is used to translate the assembly instructions to machine code, or object code. The output consists of actual instructions to be run by the target processor. This file contain machine level instructions. At this phase, only existing code is converted into machine language, the function calls like printf() are not resolved.

linking

The object code generated in the assembly stage is composed of machine instructions that the processor understands but some pieces of the program are out of order or missing. To produce an executable program, the existing pieces have to be rearranged and the missing ones filled in. This process is called linking.

The linker will arrange the pieces of object code so that functions in some pieces can successfully call functions in other pieces. It will also add pieces containing the instructions for library functions used by the program. In the case of the “Hello, World!” program, the linker will add the object code for the puts function.

The result of this stage is the final executable program. When run without options, cc will name this file a.out.

Hence ans : C

Related questions

1 votes
1 votes
1 answer
1
1 votes
1 votes
1 answer
2
3 votes
3 votes
1 answer
3
makhdoom ghaya asked Sep 11, 2016
2,132 views
One of the distinguished features of super-computer over other category of computer isParallel processingHighest accuracy levelMore speedMore capacity
2 votes
2 votes
1 answer
4
makhdoom ghaya asked Sep 8, 2016
1,089 views
The register or main memory location which contains the effective address of the operand is known asPointerSpecial locationIndexed registerNone of the above