Kamis, 28 Desember 2017

Introduction to Programming Language Concept

Programming Domains

Scientific applicationsBusiness applicationsArtificial intelligenceSystems programmingWeb Software


Language Evaluation Criteria

Readability: the ease with which programs can be read and understood
Writability: the ease with which a language can be used to create programs
Reliability: conformance to specifications (i.e., performs to its specifications)
Cost: the ultimate total cost

Influences on Language Design


Computer Architecture
Languages are developed around the prevalent computer architecture, known as the von Neumann architecture
Program Design Methodologies
New software development methodologies (e.g., object-oriented software development) led to new programming paradigms and by extension, new programming languages

Computer Architecture Influence


Well-known computer architecture: Von Neumann
Imperative languages, most dominant, because of von Neumann computers
Data and programs stored in memory
Memory is separate from CPU
Instructions and data are piped from memory to CPU
Basis for imperative languages
Variables model memory cells
Assignment statements model piping
Iteration is efficient


The von Neumann Architecture



Programming Methodologies Influences


1950's and early 1960's: Simple applications; worry about machine efficiency
Late 1960's: People efficiency became important; readability, better control structures
structured programming
top-down design and step-wise refinement
Late 1970's: Process-oriented to data-oriented
data abstraction
Middle 1980's: Object-oriented programming
Data abstraction + inheritance + polymorph


Implementation Methods


Compilation
Programs are translated into machine language; includes JIT systems
Use: Large commercial applications
Pure Interpretation
Programs are interpreted by another program known as an interpreter
Use: Small programs or when efficiency is not an issue
Hybrid Implementation Systems
A compromise between compilers and pure interpreters
Use: Small and medium systems when efficiency is not the first concern


Compilation


Translate high-level program (source language) into machine code (machine language)
Slow translation, fast execution
Compilation process has several phases:
lexical analysis: converts characters in the source program into lexical units
syntax analysis: transforms lexical units into parse trees which represent the syntactic structure of program
Semantics analysis: generate intermediate code
code generation: machine code is generated

Pure Interpretation

No translation
Easier implementation of programs (run-time errors can easily and immediately be displayed)
Slower execution (10 to 100 times slower than compiled programs)
Often requires more space
Now rare for traditional high-level languages
Significant comeback with some Web scripting languages (e.g., JavaScript, PHP)




Hybrid Implementation Systems

A compromise between compilers and pure interpreters
A high-level language program is translated to an intermediate language that allows easy interpretation
Faster than pure interpretation
Examples
Perl programs are partially compiled to detect errors before interpretation
Initial implementations of Java were hybrid; the intermediate form, byte code, provides portability to any machine that has a byte code interpreter and a run-time system (together, these are called Java Virtual Machine)









Summary


The study of programming languages is valuable for a number of reasons:
Increase our capacity to use different constructs
Enable us to choose languages more intelligently
Makes learning new languages easier
Most important criteria for evaluating programming languages include:
Readability, writability, reliability, cost
The major methods of implementing programming languages are: compilation, pure interpretation, and hybrid implementation



Reference

Robert W. Sebesta - Concept of Programming Languages (Tenth Edition), Chapter 1










Tidak ada komentar:

Posting Komentar