Presentation is loading. Please wait.

Presentation is loading. Please wait.

School of Computer & Information Engineering,

Similar presentations


Presentation on theme: "School of Computer & Information Engineering,"— Presentation transcript:

1 School of Computer & Information Engineering,
Chapter 1 :: Introduction Origin : Michael L. Scott School of Computer & Information Engineering, Sangji University Kwangman Ko

2 Reading 1, P40. Reading 2, P40

3 1. Introduction, P41 Why are there so many programming languages?
evolution - we've learned better ways of doing things over time socio-economic factors: proprietary interests, commercial advantage orientation toward special purposes orientation toward special hardware diverse ideas about what is pleasant to use

4 Introduction What makes a language successful? , PP42-43.
easy to learn(BASIC, Pascal, LOGO, Scheme) easy to express things, easy use once fluent, "powerful” C, Common Lisp, APL, Algol-68, Perl, … easy to implement (BASIC, Forth) possible to compile to very good (fast/small) code (Fortran) backing of a powerful sponsor (COBOL, PL/1, Ada, Visual Basic) wide dissemination at minimal cost (Pascal, Turing, Java)

5 1.2 Program Language Spectrum, PP45-46.
Classified into families based on Model of Computation Declarative Programming Language focused on WHAT the computer is to do. More higher level, tune with the programmer’s point of view. Imperative Programming Language focused on HOW the computer should do it. dominate, mainly for performance reasons

6 Declarative programming language
Functional Scheme, ML, pure Lisp, FP, … logic, constraint-based: Prolog, VisiCalc, RPG, … Imperative programming language von Neumann: Fortran, Pascal, Basic, C, … object-oriented: Smalltalk, Eiffel, C++, … scripting languages: Perl, Python, JavaScript, PHP, …

7 1.3 Why study programming languages?, P47~
Help you choose a language. for systems programming C vs. Modula-3 vs. C++ for numerical computations Fortran vs. APL vs. Ada for embedded systems Ada vs. Modula-2 for symbolic data manipulation Common Lisp vs. Scheme vs. ML for networked PC programs Java vs. C/CORBA

8 Reading, P48. Understand OBSCURE features:
Choose among alternative ways to express things understand implementation costs Make good use of debuggers, assemblers, linkers, and related tools Simulate useful features in languages that lack them

9 1.4 Compilation vs. Interpretation
not opposites not a clear-cut distinction Input Data Compiler Target Program Source Program Outputs Source Program Interpreter Outputs Input Data

10 Compilation vs. Interpretation
Pure Compilation translates the high-level source program into an equivalent target program(typically in machine language). COMPILER 원시 프로그램 Frontend 중간코드 Backend 목적 프로그램

11 Pure Interpretation Reading, P51.
stays around for the execution of the program the locus of control during execution Reading, P51. Interpretation Greater flexibility Better diagnostics (error messages) Compilation Better performance

12 Most language implementations, ☞ P 51.
a mixture of both compilation and interpretation compilation or simple pre-processing, followed by interpretation source program translator intermediate program Virtual Machine (interpreter) Input Data Output

13 translator Virtual Machine (interpreter) Java compiler
source program translator intermediate program Virtual Machine (interpreter) Input Data Output Test.java Java compiler (javac Test.java ) Test.class Java interpreter (java Test.class)

14 Preprocessor Removes comments and white space
Groups characters into tokens (keywords, identifiers, numbers, symbols) Expands abbreviations in the style of a macro assembler Identifies higher-level syntactic structures (loops, subroutines)

15 Library of Routines and Linking
Reading, P52. Compiler uses a linker program to merge the appropriate library of subroutines (e.g., math functions such as sin, cos, log, etc.) into the final program: source program compiler Incomplete machine program Library Routines LINKER machine program

16 Post-compilation Assembly
Facilitates debugging (assembly language easier for people to read) Isolates the compiler from changes in the format of machine language files (only assembler must be changed, is shared by many compilers)

17 The C Preprocessor (conditional compilation)
Preprocessor deletes portions of code, which allows several versions of a program to be built from the same source

18 Source-to-Source Translation (C++)
C++ implementations based on the early AT&T compiler generated an intermediate program in C, instead of an assembly language:

19 Bootstrapping

20 Dynamic and Just-in-Time(JIT) Compilation
Reading, P56. In some cases a programming system may deliberately delay compilation until the last possible moment. The Java language definition defines a machine-independent intermediate form known as byte code. Byte code is the standard format for distribution of Java programs. The main C# compiler produces .NET Common Intermediate Language (CIL), which is then translated into machine code immediately prior to execution.

21 Compilation vs. Interpretation
Tools

22 1.5 Programming Environments

23 1.6 An Overview of Compilation, PP59-60.


Download ppt "School of Computer & Information Engineering,"

Similar presentations


Ads by Google