Laporan PLC Semester 1 Session 1 Introduction

 

Screenshot (117)

 

 

Session 1: Introduction

 

A. Reasons for studying Concepts of Programming Languages

Increased ability to express ideas, Improved background for choosing appropriate languages, Increased ability to learn new languages, Better understanding of significance of implementation, Better use of languages that are already known, Overall advancement of computing.

B. Programming Domains

  • Scientific Computing

– mathematical modeling and engineering design applications

– the first application domain for computers and programming languages

– characterized by: floating point computations, array, matrix manipulations, need for efficiency (number crunching)

– languages: Fortran, ALGOL 60, parallel machine architectures and programming languages

 

  • Business Applications

– information processing and reporting applications

– characterized by: report generation facilities, decimal number manipulations ($), database interoperability, accessibility to nonprogrammers

– languages: COBOL, also affected design of Visual Basic and 4GLs (Delphi, PL/SQL)

 

  • Artificial Intelligence

– manipulating symbols instead of numbers

– characterized by: list (not array) processing, dynamic typing, self-modifying code, flexibility

– example applications: natural language processing, theorem proving, automated integration & differentiation

– languages: LISP (and other functional languages), Prolog

 

  • Systems Programming

– developing operating systems, compilers, database systems, …

– characterized by: emphasis on efficiency, ability to interface with hardware (low-level), few safety checks/restrictions

– languages: C (for implementing Unix), other specialized languages

  • Web Software

– write applications

– languages: C, C++, Java

C. 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.

D. Influences on Language Design

  • Computer architecture: Von Neumann.
  • We use imperative languages, at least in part, because we use von Neumann machines.
    • Data and programs stored in same 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.

 

  • Fetch-execute-cycle (on a von Neumann architecture computer)

 

initialize the program counter

repeat forever 

fetch the instruction pointed by the counter  increment the counter  decode the instruction  execute the instruction

end repeat.

 

  • “von Neumann Bottleneck”Screenshot (112)

E. Language Categories

  • Imperative (e.g., C and Pascal)
    • A language which operates by a sequence of commands that change the value of data elements.
    • Central features are variables, assignments statements, and iteration.
    • Includes visual languages( Visual Basic.NET) and scripting languages (JavaScript, Perl and Ruby).
  • Functional (e.g., LISP and Scheme
    • A functional language is one that operates by use of higher-order functions, building operators that manipulate functions directly without even appearing to manipulate data.
    • Main means of making computations is by applying functions to given parameters.
  • Logic (e.g., Prolog)
    • Rule-based where rules are specified in no special order.
    • Language implementation decides the execution order that produces the desired result.
  • Object-oriented (e.g., SmallTalk, C++ and C#)
    • A language in which data and the functions which access it are treated as a unit.
    • Encapsulate data objects with processing.
    • Inheritance and dynamic type binding.
    • Grew out of imperative languages.

F. Implementation Methods

  • Compilation
    • Programs are translated into machine language; includes JIT systems.
    • Use: Large commercial applications.
    • 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.

The Compilation Process

Screenshot (113)

  • Pure Interpretation
    • Programs are interpreted by another program known as an interpreter.
    • Use: Small programs or when efficiency is not an issue.
    • 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).

Pure Interpretation Process

Screenshot (114)

  • Hybrid Implementation Systems
    • A compromise between compilers and pure interpreters.
    • Use: Small and medium systems when efficiency is not the first concern.
    • 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)

Hybrid Implementation Process

Screenshot (115)

 

Layered View of Computer

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Source(s) :

users.dickinson.edu/~wahlst/356/ch1.pdf

https://prezi.com/nvowp–hkiu4/programming-domains/

http://zakarum.tistory.com/entry/Language-Design

http://zakarum.tistory.com/entry/Language-Categories

https://www8.cs.umu.se/kurser/5DV086/HT09/utdelat/PLC1.pdf

Slide Binus Maya

Leave a Reply

Your email address will not be published. Required fields are marked *