Upload
eron-miranda
View
216
Download
0
Embed Size (px)
Citation preview
7/28/2019 04 Influences in Language Design
1/24
INFLUENCES IN LANGUAGEDESIGN
Mr. Rico T. Teodoro
7/28/2019 04 Influences in Language Design
2/24
COMPUTER ARCHITECTURE
VON NEUMANN ARCHITECTURE
A/LU Control Unit
Memory Stores both instructions and data
instructions and dataResults of operations
I/O devices
Central Processing Unit
7/28/2019 04 Influences in Language Design
3/24
PROGRAMMING
METHODOLOGIES
STRUCTURED PROGRAMMING
also known as modular programming is a
subset of procedural programming thatenforces a logical structure on the program
being written to make it more efficient and
easier to understand and modify.
aimed on improving the clarity, quality, anddevelopment time of a computer program by
making extensive use of subroutines, block
structures and for and while loops
7/28/2019 04 Influences in Language Design
4/24
PROGRAMMING
METHODOLOGIES
STRUCTURED PROGRAMMING
frequently employs a top-down design model, in
which developers map out the overall programstructure into separate subsections. A definedfunction or set of similar functions is coded in aseparate module or submodule, which meansthat code can be loaded into memory more
efficiently and that modules can be reused inother programs. After a module has been testedindividually, it is then integrated with othermodules into the overall program structure.
7/28/2019 04 Influences in Language Design
5/24
PROGRAMMING
METHODOLOGIES
STRUCTURED PROGRAMMING
Program flow follows a simple hierarchical
model that employs looping constructs such as"for," "repeat," and "while." Use of the "Go To"
statement is discouraged.
7/28/2019 04 Influences in Language Design
6/24
PROGRAMMING
METHODOLOGIES
TOP-DOWN DESIGN
in which design begins by specifying complex
pieces and then dividing them into successivelysmaller pieces
A way of developing a computer program byfirst describing general functions, then breakingeach function down into details which are
refined in successive steps until the wholeprogram is fully defined.
Also called STEPWISE REFINEMENT
7/28/2019 04 Influences in Language Design
7/24
PROGRAMMING
METHODOLOGIES
Top-Down Design
in which design begins by specifying complex
pieces and then dividing them into successivelysmaller pieces
A way of developing a computer program byfirst describing general functions, then breakingeach function down into details which are
refined in successive steps until the wholeprogram is fully defined.
Also called STEPWISE REFINEMENT
7/28/2019 04 Influences in Language Design
8/24
PROGRAMMING
METHODOLOGIES
OBJECT-ORIENTED PROGRAMMING
brought about due to shift from procedure-
oriented to data-oriented design methodologies
begins with data abstraction which
encapsulates processing with data objects and
controls access to data, and adds inheritance
and dynamic method binding.
7/28/2019 04 Influences in Language Design
9/24
LANGUAGE DESIGN TRADE-
OFFS
Conflict on reliability and cost of execution
Conflict on expressivity and readability
Conflict on writability and reliability
7/28/2019 04 Influences in Language Design
10/24
IMPLEMENTATION METHODS
COMPILATION
programs can be translated into machine
language which can be executed directly on thecomputer
Advantage : very fast execution once
translation process is complete
7/28/2019 04 Influences in Language Design
11/24
IMPLEMENTATION METHODS
COMPILATION
SOURCE
PROGRAM
Language that a
compiler translates
Sourceprogram
Lexicalanalyzer
Syntaxanalyzer
Intermediatecode
generator
Codegenerator
computer
Lexical units
Parse trees
Intermediate code
Machine language
results
optimizationSymbol table
7/28/2019 04 Influences in Language Design
12/24
IMPLEMENTATION METHODS
COMPILATION LEXICAL
ANALYZER Gathers the
characters of the
source programs
into lexical units
LEXICAL UNITS
Identifiers Special words
Operators
Punctuation
symbols
Sourceprogram
Lexicalanalyzer
Syntaxanalyzer
Intermediatecode
generator
Codegenerator
computer
Lexical units
Parse trees
Intermediate code
Machine language
results
optimizationSymbol table
7/28/2019 04 Influences in Language Design
13/24
IMPLEMENTATION METHODS
COMPILATION
SYNTAX
ANALYZER
Takes lexical units
to construct
structures called
PARSE TREES that
represents the
syntactic structure
of the program
Sourceprogram
Lexicalanalyzer
Syntaxanalyzer
Intermediatecode
generator
Codegenerator
computer
Lexical units
Parse trees
Intermediate code
Machine language
results
optimizationSymbol table
7/28/2019 04 Influences in Language Design
14/24
IMPLEMENTATION METHODS
COMPILATION
INTERMEDIATE
CODE
GENERATOR
Produces a
program in a
different language
at an intermediate
level between the
source program and
machine language
Sourceprogram
Lexicalanalyzer
Syntaxanalyzer
Intermediatecode
generator
Codegenerator
computer
Lexical units
Parse trees
Intermediate code
Machine language
results
optimizationSymbol table
7/28/2019 04 Influences in Language Design
15/24
IMPLEMENTATION METHODS
COMPILATION
OPTIMIZATION
Improves program
by making them
smaller or faster or
both
Sourceprogram
Lexicalanalyzer
Syntaxanalyzer
Intermediatecode
generator
Codegenerator
computer
Lexical units
Parse trees
Intermediate code
Machine language
results
optimizationSymbol table
7/28/2019 04 Influences in Language Design
16/24
IMPLEMENTATION METHODS
COMPILATION
CODE
GENERATOR
Translates the
optimized
intermediate code
version of the
program into an
equivalent machine
language program
Sourceprogram
Lexicalanalyzer
Syntaxanalyzer
Intermediatecode
generator
Codegenerator
computer
Lexical units
Parse trees
Intermediate code
Machine language
results
optimizationSymbol table
7/28/2019 04 Influences in Language Design
17/24
IMPLEMENTATION METHODS
COMPILATION
SYMBOL TABLE
Serves a database
containing type and
attribute information
of each user-
defined name in the
program
Sourceprogram
Lexicalanalyzer
Syntaxanalyzer
Intermediatecode
generator
Codegenerator
computer
Lexical units
Parse trees
Intermediate code
Machine language
results
optimizationSymbol table
7/28/2019 04 Influences in Language Design
18/24
IMPLEMENTATION METHODS
COMPILATION (Stages from Source to Executable)
Compilation: source code ==> relocatable object code (binaries) Linking: many relocatable binaries (modules plus libraries) ==>
one relocatable binary (with all external references satisfied)
Loading: relocatable ==> absolute binary (with all code and data
references bound to the addresses occupied in memory)
Execution: control is transferred to the first instruction of theprogram
7/28/2019 04 Influences in Language Design
19/24
IMPLEMENTATION METHODS
PURE INTERPRETATION Programs are interpreted with no translation
The INTEPRETER acts as a software simulation of a machine whosefetch-execute cycle deals with high-level language program
statements rather than machine instructions
Advantage : allows easy implementation of many source-level
debugging operations
Disadvatage :
slower in decoding Need for more space
7/28/2019 04 Influences in Language Design
20/24
IMPLEMENTATION METHODS
PURE
INTERPRETATION Source program
intepreter
result
Input data
7/28/2019 04 Influences in Language Design
21/24
IMPLEMENTATION METHODS
HYBRID IMPLEMENTATION Compromise between compilers and pure interpreters
Translate high-level programs to an intermediate language designedto allow easy interpretation
Advantage : faster than pure interpretation since source needs to be
decoded only once.
7/28/2019 04 Influences in Language Design
22/24
IMPLEMENTATION METHODS
HYBRIDSource
program
Lexicalanalyzer
Syntaxanalyzer
Intermediatecode
generator
Lexical units
Parse trees
results
interpreter
Intermediate codeInput data
7/28/2019 04 Influences in Language Design
23/24
PREPROCESSOR
Program that processes a program immediately
before the program is compiled
7/28/2019 04 Influences in Language Design
24/24
PROGRAMMING
ENVIRONMENT
Collection of tools used in the development of a
software
May consist of :
File system
Editor
Linker
Compiler