Presentation on theme: "Summer 02-03Programming Language Concepts1 Programming Language Concepts (CS 360) Lecture 1: Overview, Grammars, and Little Languages Jeremy R. Johnson."— Presentation transcript:
Summer 02-03Programming Language Concepts1 Programming Language Concepts (CS 360) Lecture 1: Overview, Grammars, and Little Languages Jeremy R. Johnson (Guest Lecturer)
Summer 02-03Programming Language Concepts2 Basic Info Instructor –Sam Moelius –Email: email@example.com@cs.drexel.edu –Office Hours: TBD Text –Concepts of Programming Languages, 5 th Ed. –Robert W. Sebesta –Addison Wesley Web Page –TBD Mailing List –TBD
Summer 02-03Programming Language Concepts3 Course Description Introduces the design and implementation of modern programming languages: formal theory underlying language implementation; concerns in naming, binding, storage allocation and typing; semantics of expressions and operators, control flow, and subprograms; procedural and data abstraction; functional, logic, and object-oriented languages. Students will construct an interpreter for a non-trivial language.
Summer 02-03Programming Language Concepts4 Course Prerequisites CS 171 (Prog. I), 172 (Prog. II), and 260 (Data structures) Comfortable with an object-oriented language (ideally should have seen at least two languages) Ideal: –CS 281 (Systems Architecture I) – understanding of the underlying of basic computer architecture (assembly language, machine organization) –CS 270 (Foundations of Computer Science) – should be comfortable with the mathematical tools used to describe and analyze programming languages (logic, recursion – material on finite state machines and grammars useful but will be covered in this class)
Summer 02-03Programming Language Concepts5 Course Themes Tools to evaluate design of languages Tools for describing and analyzing languages –syntax –semantics Tools to design new languages Programming Paradigms Implementation of programming languages
Summer 02-03Programming Language Concepts6 Course Objectives 1.Understand how to compare and evaluate different programming languages and know what factors need to be taken into account. 2.Be comfortable with the major programming paradigms and be able to use at least one language from each paradigm. 3.Understand some of the issues involved in implementation of programming languages; this should help them program more efficiently. 4.Be familiar with elementary concepts of formal language theory such as context-free grammar. 5.Be able to formally specify the syntax of programming languages. 6.Be familiar with the essentials of lexical analysis and elementary parsing procedures. 7.Understand dynamic and static scope, dynamic and static binding and the issues they give rise to. 8.Understand the advantages and disadvantages of strong/weak type checking. 9.Understand the different methods of parameter passing and how they might be implemented and understand some of the issues involved in calling subroutines. 10.Understand generic programming.
Summer 02-03Programming Language Concepts7 Tentative Topics 1.Week 1: Overview and introductions to grammars (ch. 1 & 3) 2.Week 2: Functional Languages (ch. 15) 3.Week 3: Logic Programming Languages (ch. 16) 4.Week 4: Syntax, Types, Scanning, and Parsing (ch. 3-5) 5.Week 5: Midterm (more on types and type checking) 6.Week 6: Data types and Memory allocation (ch. 6) 7.Week 7: Program semantics and interpreters (ch. 3) 8.Week 8: Control Structures. Iteration versus Recursion and their implementation. Templates in C++ and generic programming and its advantages and pitfalls (ch. 7-9). 9.Week 9: Subroutines and Parameter Passing Methods, Implementing subroutines (ch. 9-10). 10.Week 10: Abstract data types and object-oriented programming (ch. 11-12)
Summer 02-03Programming Language Concepts8 Course Benefits Easier to express ideas Improved background for selecting appropriate languages Easier to learn new languages Understand the significance and impact of language choices and constructs Design new languages (little languages, interface specifications, protocols) Overall advancement of computing
Summer 02-03Programming Language Concepts9 Grading Policy Assignments (Programming & Description & Evaluation) –5 @ 10% each Midterm Exam –25% Final Exam –25% Grades will be determined using a curve with the weighted average equal to a B provided the average shows understanding of the material. All work must be completed independently unless explicitly stated other wise. Not following this rule is subject to receiving a 0 for the first offense and subsequent offenses may lead to a lower or failing grade.
Summer 02-03Programming Language Concepts10 Outline (Ch. 1) Programming Domains Programming Paradigms Language Evaluation Criteria –Readability –Writability –Reliability –Cost Influences on language design –Computer architecture –Programming methodologies Language categories –Imperative –Functional –Logic –Object-oriented Implementation methods –Interpreter –Compiler –Hybrid
Summer 02-03Programming Language Concepts11 Programming Domains Scientific Computing –FORTRAN –C, C++ –Matlab, Maple, Mathematica Business Applications –COBOL –Spreadsheet, DB, SAP Systems Programming –assembly –PL/S, BLISS, C Scripting Languages –sh, ksh, bash –awk, perl, python Artificial Intelligence –lisp, prolog Special-purpose languages
Summer 02-03Programming Language Concepts12 Programming Paradigms Imperative (procedural) –Algol, C, FORTRAN, Pascal Data Abstraction –Modula-2 Object Oriented –Simula 67, Smalltalk, C++, java, Ada 95, Eiffel Functional –Lisp, Scheme, ML Logic (declarative – rule based) –prolog Parallel Hardware Description Languages Markup Special-purpose
Summer 02-03Programming Language Concepts13 Evaluation Criteria Readability –Simplicity –Orthogonality –Control statements –Appropriate data types –Syntax considerations Writability –Simplicity and orthogonality –Support for abstraction –Expressivity Reliability –type checking –exception handling –Aliasing Cost –readability and the learning curve –writability and naturalness of the language for the application –compilation and execution time
Summer 02-03Programming Language Concepts14 Compilation Lexical Analyzer Syntax Analyzer Intermediate Code Generation Symbol Table Optimizer Code Generator Computer Lexical Units Parse Tree Intermediate Code Machine Language User Inputs Source Program Results
Summer 02-03Programming Language Concepts15 von Neumann Architecture Control CPU Memory ALU I/O Fetch-Execute Cycle 1.Initialize PC, Registers 2.Repeat 1.Fetch Instruction 2.Increment PC 3.Decode Instruction 4.Execute Instruction
Summer 02-03Programming Language Concepts16 Interpretation Source Program Interpreter User Inputs Results