Title: Programming Language Ch II' Machine Architecture and Language
1Programming LanguageCh II. Machine Architecture
and Language
- Internet Management Technology Lab.
2Contents
- Computer Architecture and Language Related Issues
- Compiler and translation related issues
- Programming Environments
3Computer Architecture and Language Related Issues
- Conventional Computer Organization
Central Processing Unit
4Computer Architecture and Language Related Issues
- Major components of a computer that correspond to
the six major aspects of a PL - Data
- Elementary data types and structures
- Data storages are high speed registers, main
memory, and external files - Built-in data vs. structured data
- Operations
- Set of operations to manipulate the data
- Arithmetic, testing, accessing, modifying,
control devices, and sequence control
5Computer Architecture and Language Related Issues
- Sequence Control
- Mechanisms to control the instruction sequence
control - Use of program address register
- IF branch operations are used to control
sequences, - Refer following figure
6Computer Architecture and Language Related Issues
- Data Access
- Mechanism to access and control the data
- Serial access vs. parallel access
- Storage management
- Mechanism to control the storage of data and
instructions - Imbalance due to access time (I/O(5-10 ms),
memory(15-100ns), and register(2-5ns)) - Delayed I/O access needs multiprogramming
- Delayed memory access needs cache memory
7Computer Architecture and Language Related Issues
- Operational environment
- Mechanisms for communication with external
devices - I/O devices (CD-ROM, Tapes, Modems)
- Other Factors
- System Architecture
- Von Neumann vs. Multiprocessor system
- RISC, SIMD, MIMD, SPMD
8Compiler and translation related issues
- Translators involved in compilation
- Preprocessor
- Lexer and parser
- Optimizer
- Code generator
- Assembler
- Linker and Loader
Source program
preprocessor
lexer parser
optimizer
code generator
Run time Support library
Assembly
Object code
linker
excutable code
loader
data
Processing unit
?? 2.3 Program Translation and execution
9Compiler and translation related issues
- Language classification by translation method
10Compiler and translation related issues
- Binding Times
- The choice of properties or characteristic for a
programming elements - Binding Times
- Program execution time
- Program translation time by
- programmer
- Translator
- Loader
- Language implementation time
- Language definition time
11Compiler and translation related issues
- Syntax
- Grammar ltT,N,P,Sgt
- Terminal
- A finite set of terminals
- Nonterminal
- A finite set of non-terminals not in T
- Production
- A finite set of production(rewriting) rules
- Start Symbol
- An element of N the distinguished starting
non-terminal
12Compiler and translation related issues
- Chomsky hierarchy
- Unrestricted grammar
- No restrictions applied
- Recognized by Turing Machine (infinite r/w tape)
- Context sensitive Grammar
- Too complex for a specification of computer
languages - Recognized by Linear Bounded Automaton (LBA)
- Context Free Grammar
- The derivations are invoked independent of what
surrounds them - Modern programming languages are specified with
CFG but expanded to CSG with attributes - Recognized by Push Down Automaton (PDA)
- Regular Grammar
- Too restrictive for most purpose however, very
efficient recognizer can be built - Recognized by Finite State Automaton
13Compiler and translation related issues
- Syntax (contd)
- Notations
- BNF (Backus-Naur Form) ltsentencegt ltdeclgt lt
interroogategt - Parsing
- LL(k) parser or LR(k) parser generate parsing
tree based on given grammar - Semantics
- Meaning given to the various semantic constructs
- Attribute grammars
- Propositional logic
14Programming Environments
- Environment that programs are created and tested
- A set of support tools and command language to
invoke - Editors, debuggers, verifiers, test data
generators, and pretty printers - Separate programming
- Convenient but raise many issues such as data
type declaration, subprogram calls, etc. - Test debugging such as tracing, break pointing,
and assertions, etc