Download presentation
Presentation is loading. Please wait.
Published byMercy Robbins Modified over 8 years ago
1
The College of Saint Rose CIS 433 – Programming Languages David Goldschmidt, Ph.D. from Concepts of Programming Languages, 9th edition by Robert W. Sebesta, Addison-Wesley, 2010, ISBN 0-13-607347-6
2
Why study programming languages? Required course... Diverse set of tools in your programming toolbox Increased capacity to express ideas Increased ability to build efficient and easy-to-maintain software systems Why so many languages?
3
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
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
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
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
Imperative Languages Data and programs are both stored in memory Variables mimic memory Assignment statements Arithmetic operations Iterative repetition Control structures etc.
8
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
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
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
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
Low-level languages LDA #47 STA $570 DEX JSR $817 CPX #0 BNE #14 assembly code 10001010 00100100 10101011 01001011 10111100 01010001 machine code (executable) translation program (assembler)
13
#include int main() { float x; cout << "... C++ source code 10001010 00100100 10101011 01001011 intermediate code (object code) translation program (compiler) 10001010 00100100 10101011 01001011 10111100 01010001 machine code (executable) linker program 10001010 00100100 10101011 01001011 intermediate code of precompiled libraries ( object code)
14
public static void main( String[] args ) { float x; System.out. println( "... Java source code 7A 56 78 9F FE F2 65 58 99 76 6D 4E intermediate code (byte code) translation program (compiler) virtual machine (JVM) A6 65 54 98 8F AB AE 33 38 8F DA 44 intermediate code of precompiled libraries (java.util.Scanner byte code) program execution
16
lexical analysis groups characters into lexical units syntax analysis transforms lexical units into parse trees a parse tree represents the syntactic structure of the program analyzes parse trees to produce intermediate code transforms intermediate code into executable machine code
17
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
lexical analysis groups characters into lexical units syntax analysis transforms lexical units into parse trees analyzes parse trees to produce intermediate code intermediate code executed via a virtual machine
19
A preprocessor transforms source code into preprocessed source code Source program Preprocessor Preprocessed source program #include #define PI 3.14159 #define E 2.781828 #ifdef DEBUG_MODE #endif C source code
20
Read and study Chapters 1 and 2 Do Exercises at the end of Chapter 1 Categorize every programming language as compiled, interpreted, hybrid, etc.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.