1 / 20

Isn’t one language enough ? {week 01}

The College of Saint Rose CIS 433 – Programming Languages David Goldschmidt, Ph.D. Isn’t one language enough ? {week 01}. from Concepts of Programming Languages , 9th edition by Robert W. Sebesta, Addison-Wesley, 2010, ISBN 0-13-607347-6. Programming languages.

brinly
Télécharger la présentation

Isn’t one language enough ? {week 01}

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The College of Saint Rose CIS 433 – Programming Languages David Goldschmidt, Ph.D. Isn’t one language enough?{week 01} from Concepts of Programming Languages, 9th edition by Robert W. Sebesta, Addison-Wesley, 2010, ISBN 0-13-607347-6

  2. Programming languages • Why study programming languages? • Required course... • Diverse set of tools in yourprogramming toolbox • Increased capacity to express ideas • Increased ability to build efficient andeasy-to-maintain software systems • Why so many languages?

  3. Programming domains (i) • Languages are not entirely general-purpose • Business applications (typically distributed) • Process data, output reports, control transactions • Increasingly distributed • Manufacturing and control systems • Reliability and non-stop operation • Entertainment and Web applications • Wide variety of online and device requirements • Portability

  4. Programming domains (ii) • Languages are not entirely general-purpose • Scientific applications • Often computationally intensive • Artificial intelligence and research applications • Represent and manipulate symbols instead of numbers • Also often computationally intensive • Systems and network programming • Operating system and support programs • Requires efficient non-stop operations

  5. Language evaluation criteria • How can we evaluate a programming language? • Goals of the language • Readability • Writability • Portability • Reliability (of the language—e.g. C++ vs. Java) • Cost ($$$, training costs, compilation process) • Ease of maintenance (of compilers and source code)

  6. Language design tradeoffs • Readability vs. writability • Perl is flexible and expressive—very writable • As a result, Perl is sometimes hard to read... • Writability vs. reliability • C and C++ both provide flexible use of pointers • As a result, C and C++ can be unreliably used • Thus producing core dumps, null pointer references

  7. Von Neumann architecture • Imperative Languages • Data and programs are both stored in memory • Variables mimic memory • Assignment statements • Arithmetic operations • Iterative repetition • Control structures • etc.

  8. A brief history of programming • 1940s – von Neumann architecture • 1950s – simple applications (hardware focus) • 1960s/1970s – structured programming • Costs shifted from hardware to software • Complexity and size of software grew dramatically • 1970s/1980s – data-oriented program design • 1980s – object-oriented program design • Data abstraction + Inheritance + Polymorphism • 1990s/2000s – network/Web applications • 2010s – mobile applications

  9. Language categories (i) • Imperative languages: • Evolved from the von Neumann architecture • Focus on variables, assignment and arithmetic statements, control structures, and iterative constructs • e.g. C, C++, Pascal, C#, Java, Perl, JavaScript, etc.

  10. Language categories (ii) • Functional languages: • Apply (often recursive) functions to parameters • Usually an interpretive language • e.g. LISP, Scheme • Logic languages: • Rule-based approach to build a knowledge base • Perform queries against knowledge base • e.g. Prolog (also the Semantic Web)

  11. Language categories (iii) • Object-oriented languages: • Evolved out of imperative languages • Data abstraction, inheritance, polymorphism,late binding • e.g. C++, Java, C#, Smalltalk, Eiffel • Markup and Web languages: • Web-based or application-specific markup languages specify layout of Web pages, database schemas, etc. • e.g. XHTML, XML, XSLT, MathML, RDF, etc.

  12. How low can you go? • Low-level languages LDA #47 STA $570 DEX JSR $817 CPX #0 BNE #14 100010100010010010101011010010111011110001010001 translation program (assembler) assembly code machine code (executable)

  13. High-level languages (i) #include <iostream> int main() { float x; cout << " ... 10001010001001001010101101001011 translation program (compiler) intermediate code (object code) C++ source code 100010100010010010101011010010111011110001010001 10001010001001001010101101001011 linker program intermediate code of precompiled libraries (<iostream> object code) machine code (executable)

  14. High-level languages (ii) public static void main( String[] args ) { float x; System.out. println( " ... 7A 56 78 9F FE F2 65 58 99 76 6D 4E translation program (compiler) intermediate code (byte code) Java source code A6 65 54 98 8F AB AE 33 38 8F DA 44 virtual machine (JVM) program execution intermediate code of precompiled libraries (java.util.Scanner byte code)

  15. Layers

  16. Compilation a parse tree represents the syntactic structure of the program lexical analysis groupscharacters into lexical units syntax analysis transformslexical units into parse trees analyzes parse trees to produce intermediate code transforms intermediate code into executable machine code

  17. Interpreter source code is both interpreted and executed via an interpreter REM COMMENT LET X = 5 LET Y = 8 PRINT X PRINT Y LET Z = X PRINT Z INPUT A$ BASIC source code

  18. Hybrid lexical analysis groupscharacters into lexical units syntax analysis transformslexical units into parse trees intermediate code executed via a virtual machine analyzes parse trees to produce intermediate code

  19. Source program Preprocessor Preprocessed source program Preprocessing • A preprocessor transforms source codeinto preprocessed source code #include <stdio.h> #define PI 3.14159 #define E 2.781828 #ifdef DEBUG_MODE #endif C source code

  20. What next? • Read and study Chapters 1 and 2 • Do Exercises at the end of Chapter 1 • Categorize every programming language as compiled, interpreted, hybrid, etc.

More Related