Вы находитесь на странице: 1из 24

INFLUENCES IN LANGUAGE DESIGN

Mr. Rico T. Teodoro

COMPUTER ARCHITECTURE
VON

NEUMANN ARCHITECTURE
Memory
Stores both instructions and data

Results of operations

instructions and data

A/LU

Control Unit
Central Processing Unit

I/O devices

PROGRAMMING METHODOLOGIES
STRUCTURED

PROGRAMMING

also known as modular programming is a subset of procedural programming that enforces 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, and development time of a computer program by making extensive use of subroutines, block structures and for and while loops

PROGRAMMING METHODOLOGIES
STRUCTURED

PROGRAMMING

frequently employs a top-down design model, in which developers map out the overall program structure into separate subsections. A defined function or set of similar functions is coded in a separate module or submodule, which means that code can be loaded into memory more efficiently and that modules can be reused in other programs. After a module has been tested individually, it is then integrated with other modules into the overall program structure.

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.

PROGRAMMING METHODOLOGIES
TOP-DOWN

DESIGN

in which design begins by specifying complex pieces and then dividing them into successively smaller pieces A way of developing a computer program by first describing general functions, then breaking each function down into details which are refined in successive steps until the whole program is fully defined. Also called STEPWISE REFINEMENT

PROGRAMMING METHODOLOGIES
Top-Down

Design

in which design begins by specifying complex pieces and then dividing them into successively smaller pieces A way of developing a computer program by first describing general functions, then breaking each function down into details which are refined in successive steps until the whole program is fully defined. Also called STEPWISE REFINEMENT

PROGRAMMING METHODOLOGIES
OBJECT-ORIENTED

PROGRAMMING

brought about due to shift from procedureoriented 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.

LANGUAGE DESIGN TRADEOFFS


Conflict

on reliability and cost of execution Conflict on expressivity and readability Conflict on writability and reliability

IMPLEMENTATION METHODS
COMPILATION

programs can be translated into machine language which can be executed directly on the computer Advantage : very fast execution once translation process is complete

IMPLEMENTATION METHODS
COMPILATION

Source program

Lexical analyzer

SOURCE PROGRAM

Lexical units

Syntax analyzer
Parse trees

Language that a compiler translates

Symbol table

Intermediate code generator

optimization

Intermediate code

Code generator
Machine language

computer
results

IMPLEMENTATION METHODS
COMPILATION LEXICAL ANALYZER

Source program

Lexical analyzer
Lexical units

Gathers the characters of the source programs into lexical units LEXICAL UNITS

Syntax analyzer
Parse trees

Symbol table

Intermediate code generator

optimization

Identifiers Special words Operators Punctuation symbols

Intermediate code

Code generator
Machine language

computer
results

IMPLEMENTATION METHODS
COMPILATION

Source program

Lexical analyzer

SYNTAX ANALYZER

Lexical units

Syntax analyzer
Parse trees

Takes lexical units to construct structures called PARSE TREES that represents the syntactic structure of the program

Symbol table

Intermediate code generator

optimization

Intermediate code

Code generator
Machine language

computer
results

IMPLEMENTATION METHODS
COMPILATION

Source program

Lexical analyzer

INTERMEDIATE CODE GENERATOR

Lexical units

Syntax analyzer
Parse trees

Produces a program in a different language at an intermediate level between the source program and machine language

Symbol table

Intermediate code generator

optimization

Intermediate code

Code generator
Machine language

computer
results

IMPLEMENTATION METHODS
COMPILATION

Source program

Lexical analyzer

OPTIMIZATION

Lexical units

Improves program by making them smaller or faster or both

Syntax analyzer
Parse trees

Symbol table

Intermediate code generator

optimization

Intermediate code

Code generator
Machine language

computer
results

IMPLEMENTATION METHODS
COMPILATION

Source program

Lexical analyzer

CODE GENERATOR

Lexical units

Syntax analyzer
Parse trees

Translates the optimized intermediate code version of the program into an equivalent machine language program

Symbol table

Intermediate code generator

optimization

Intermediate code

Code generator
Machine language

computer
results

IMPLEMENTATION METHODS
COMPILATION

Source program

Lexical analyzer

SYMBOL TABLE

Lexical units

Serves a database containing type and attribute information of each userdefined name in the program

Syntax analyzer
Parse trees

Symbol table

Intermediate code generator

optimization

Intermediate code

Code generator
Machine language

computer
results

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 the program

IMPLEMENTATION METHODS
PURE

INTERPRETATION

Programs are interpreted with no translation The INTEPRETER acts as a software simulation of a machine whose fetch-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

IMPLEMENTATION METHODS
PURE

INTERPRETATION
Input data

Source program

intepreter

result

IMPLEMENTATION METHODS
HYBRID

IMPLEMENTATION

Compromise between compilers and pure interpreters Translate high-level programs to an intermediate language designed to allow easy interpretation Advantage : faster than pure interpretation since source needs to be decoded only once.

IMPLEMENTATION METHODS
HYBRID
Source program

Lexical analyzer
Lexical units

Syntax analyzer
Parse trees

Intermediate code generator


Input data
Intermediate code

interpreter

results

PREPROCESSOR
Program

that processes a program immediately before the program is compiled

PROGRAMMING ENVIRONMENT
Collection

of tools used in the development of a

software May consist of :

File system Editor Linker Compiler

Вам также может понравиться