Chapter 1
Chapter 1
Chapter 1
C supports low-level access to memory using address pointers. This makes C language a choice for
implementing system software.
C supports array data structure with two ways to access array elements, indexes and pointers.
C supports dynamic memory allocation, which helps to reduce the size of object file generated by the
compiler, and allow arrays to be declared with sizes determined at runtime.
C supports a large number of library routines for input/output operations, string manipulations,
mathematical functions, etc.
C uses a header file to share declarations of variables and functions of a program module with other
modules.
C does not do bounds checking on arrays. This often leads to un-desired behaviors during program
execution.
Purpose
Lexical Analyzer
Syntactic
Analyzer
Semantic
Analyzer
Code Generator
Linearizes the Qualified Code and produces the equivalent Object Code
Optimizer
Examines the Object Code to determine whether there are more efficient means of
execution
** The Symbol Table is the data structure that all elements of the compiler use to collect and share
information about symbols and groups of symbols in the program being translated.
Definition: In computing, an interpreter is a computer program that reads the source code of another
computer program and executes that program.
Because it is interpreted line by line, it is a much slower way of running a program than one that has been
compiled but is easier for learners because the program can best opted, modified and rerun without timeconsuming compiles.
Compiler vs. Interpreter
An interpreter translates some form of source code into a target representation that it can immediately
execute and evaluate. The structure of the interpreter is similar to that of a compiler, but the amount of time
it takes to produce the executable representation will vary as will the amount of optimization. The following
diagram shows one representation of the differences.
Compiler characteristics:
spends a lot of time analyzing and processing the program
the resulting executable is some form of machine- specific binary code
the computer hardware interprets (executes) the resulting code
program execution is fast
Interpreter characteristics:
relatively little time is spent analyzing and processing the program
the resulting code is some sort of intermediate code
the resulting code is interpreted by another program
program execution is relatively slow