Programming Languages
This presentation is the property of its rightful owner.
Sponsored Links
1 / 15

Review of the Previous Lecture PowerPoint PPT Presentation


  • 104 Views
  • Uploaded on
  • Presentation posted in: General

Programming Languages (ICE 1341) Lecture #2 February 27, 2004 In-Young Ko iko .AT. i cu . ac.kr Information and Communications University (ICU). Review of the Previous Lecture. Purposes of learning programming languages Programming domains Programming paradigms.

Download Presentation

Review of the Previous Lecture

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Review of the previous lecture

Programming Languages(ICE 1341)Lecture #2February 27, 2004In-Young Koiko .AT. icu.ac.krInformation and Communications University (ICU)

ICE 1341 – Programming Languages (Lecture #2) In-Young Ko


Review of the previous lecture

Review of the Previous Lecture

  • Purposes of learning programming languages

  • Programming domains

  • Programming paradigms

ICE 1341 – Programming Languages (Lecture #2) In-Young Ko


Language evaluation criteria

Language Evaluation Criteria

  • Readability: How easy to read and understand programs?

    • Machine orientation vs. Human orientation

    • In the context of the problem domain

  • Writability: How easy to create programs for a problem domain?

    • In the context of the problem domain

  • Reliability: How easy to prevent, detect and handle errors?

ICE 1341 – Programming Languages (Lecture #2) In-Young Ko


Language evaluation criteria readability factors

Language Evaluation Criteria – Readability Factors

  • Simplicity

    • Number of basic components

    • Feature Multiplicity

      e.g., count = count + 1; count += 1; count++; ++count

    • Operator Overloading

      e.g., int a = b + 7; float x = y + 0.7; String s = hello + “world”

      int[] p = new int[] { 1, 2 } + new int[] { 3, 4 }

  • Orthogonality:Fewer exceptions in combining primitive constructs

    e.g., void[] x = new void[10]

  • Control Statement

    e.g., while loop vs. goto statement

  • Data Types and Structures

    e.g., timeOut = 1 vs. timeOut = true; a record array vs. a set of arrays

  • Syntax Considerations

    • Identifier forms: e.g., length restriction, case sensitivity

    • Keyword selections: e.g., { } vs. Begin – End

    • Meaning: e.g., static variables vs. static methods in Java

ICE 1341 – Programming Languages (Lecture #2) In-Young Ko


Language evaluation criteria writability factors

Language Evaluation Criteria – Writability Factors

  • Simplicity and Orthogonality

  • Abstraction: ability to define and use complicated structures or operations

    • e.g., subprograms, interfaces

  • Expressivity: convenience in specifying computations

    • e.g.1, count++ vs. count = count + 1

    • e.g.2, if (a == 2 && b == 3) vs.

      if (a == 2 and then b == 3)

    • e.g.3, for vs. while

ICE 1341 – Programming Languages (Lecture #2) In-Young Ko


Language evaluation criteria reliability factors

Language Evaluation Criteria – Reliability Factors

  • Type Checking: testing for inconsistency in using data types

    • Compile-time checking is more desirable

    • Explicit type casting improves correctness

      • e.g., int a = 3 / 5 + 4 / 7

        int a = (int)((float)3 / 5 + (float)4 / 7)

  • Exception Handling: intercepting run-time errors and performing recovery actions

    • Programs can continue its execution after the recovery action

  • Aliasing: having two or more referencing names for the same memory block

    • Aliasing makes programmers hard to debug programs

    • e.g., pointers in C

  • Readability and Writerbility

ICE 1341 – Programming Languages (Lecture #2) In-Young Ko


Cost of a programming language

Cost of a Programming Language

  • Cost of training programmers

  • Cost of writing programs

    • Good programming environment lowers the cost

  • Cost of compiling programs

  • Cost of executing programs

    • Optimization may lower the execution cost

  • Cost of the language implementation system (compilers and run-time platforms)

  • Cost of poor reliability

    • Unreliable languages cannot be used for developing mission-critical programs

  • Cost of maintaining programs

  • Other cost factors: portability, generality

ICE 1341 – Programming Languages (Lecture #2) In-Young Ko


Imperative languages

Imperative Languages

  • Languages that are designed based on the von Neumann architecture

    • Basic language elements:

      • Variables

      • Assignment Statements

      • Iteration controls

* Sebesta Figure 1.1

ICE 1341 – Programming Languages (Lecture #2) In-Young Ko


Influences on language design

Influences on Language Design

  • Programming methodologies

    • 1950s and early 1960s: Simple applications; worry about machine efficiency

    • Late 1960s: People efficiency became important; readability, better control structures

      • Structured programming

      • Top-down design and step-wise refinement

    • Late 1970s: Process-oriented to data-oriented

      • Data abstraction

    • Middle 1980s: Object-oriented programming

    • Middle 1990s: Component-based programming

    • Present: Service-oriented programming

* AW Lecture Notes

ICE 1341 – Programming Languages (Lecture #2) In-Young Ko


Compilation process

:=

id1

+

id2

*

id3

60

:=

id1

+

id2

*

inttoreal

id3

60

Compilation Process

position := initial + rate * 60

Source Program

Intermediate Code Generator

Lexical Analyzer

temp1 := inttoreal(60)

temp2 := id3 * temp1

temp3 := id2 + temp2

id1 := temp3

id1 := id2 + id3 * 60

Intermediate Code

Syntax Analyzer

Code Optimizer

Parse Tree

temp1 := id3 * 60.0

id1 := id2 + temp1

Semantic Analyzer

Code Generator

MOVF id3, R2

MULF #60.0, R2

MOVF id2, R1

ADDF R2, R1

MOVF R1, id1

Assembly Code

* hjbang.snut.ac.kr/data/compiler/compiler_1.ppt

ICE 1341 – Programming Languages (Lecture #2) In-Young Ko


Program execution

Program Execution

  • Repetition of the fetch-execution cycle

* www.faqs.org/docs/javap/c1/s1.html

ICE 1341 – Programming Languages (Lecture #2) In-Young Ko


Layered view of computer

Layered View of Computer

* Sebesta Figure 1.2

* AW Lecture Notes

ICE 1341 – Programming Languages (Lecture #2) In-Young Ko


Pure interpretation

Pure Interpretation

  • Software simulation of the fetch-execution cycle

  • Directly execute high-level language statements

  • Slow process due to the decoding bottleneck

  • e.g., BASIC, LISP, JavaScript

* Sebesta Figure 1.4

ICE 1341 – Programming Languages (Lecture #2) In-Young Ko


Hybrid implementation systems

Hybrid Implementation Systems

  • Compromise between compilers and pure interpreters

  • Increase the portability of programs

  • e.g., Perl, Java

ICE 1341 – Programming Languages (Lecture #2) In-Young Ko


Review of the previous lecture

HW#1

  • Among the programming languages described in Chapter 2, please choose 3 languages and summarize the following information about the languages:

    • Historic background (1-2 lines)

    • Programming domains

    • Programming paradigms

    • Special features

    • Pros and cons

    • Questions

ICE 1341 – Programming Languages (Lecture #2) In-Young Ko


  • Login