CS 332 Programming Language Concepts

2y ago
59 Views
2 Downloads
6.76 MB
15 Pages
Last View : 4d ago
Last Download : 3m ago
Upload by : Ronnie Bonney
Transcription

CS 332Programming Language ConceptsLecture 14 – REVIEW(PLP Chapters 8-12)April 14, 2020 Sam Siewert

Exam #2 on Canvas 4/22-4/242 hours to complete, 1 attempt, no outside expert help– Open book, open notes ok– If you re-use any code or material from Internet be sure to cite andexplainExam #1, #2, worth at most 15% of grade each [30% total]Assignment practice, participation and scaffold is 40%Final Exam worth 20% or more [presentation, Ex #6 report]Participation Based on Attendance and Final ExamAttendance (Q&A for other groups)Overall policies – Active Learning Grading Policy Sam Siewert2

Final Presentation ZOOMStandard Exam Time Presentation optionRegister for ZOOMSTANDARD EXAM TIMEALTERNATE TIMEOverflow Presentation timeSchedule Coming Soon! Sam Siewert3

Major ConceptsCore Language Design es and Parameter Passing – Ch. 8– See Modes on P. 4041. Value2. Reference3. ClosureData Abstraction and OO – Ch. 9– What is Required for an OOP (P. 449)– Parametric and Class Instance Dynamic Binding with InheritanceAlternative Programming Models ---------------------------Functional Languages – Ch. 10– Lisp and SchemeLogic Languages (PROLOG) – Ch. 11Concurrency Built-in or Library – Ch. 12 Sam Siewert4

Core Language DesignSubroutinesandObject Oriented Programming Sam Siewert5

PLP Ch. 8Subroutine Calls and Parameter Passingcall by value: copy going into the procedurecall by result: copy going out of the procedurecall by value result: copy going in, and again going outcall by reference: pass a pointer to the actual parameter, andindirect through the pointer– call by name: re-evaluate the actual parameter on every use.For actual parameters that are simple variables, this is the sameas call by reference. For actual parameters that are expressions,the expression is re-evaluated on each access. It should be aruntime error to assign into a formal parameter passed by name,if the actual parameter is an expression.– Closure (just read and understand concept of enclosing contextwith function call)–––– Sam Siewert6

Parameter Passing - for Well-Known PLsAda - in (by value), out (byresult), in/out (byvalue/result)– Optimization for recordsand arrays (reference)C by value onlyC reference addedFORTRAN - generally byreference onlyJava - by value AND byreference– built-in by value– Class by shared reference Sam Siewert1. UW CS examples2. FSU notes7

PLP Ch. 8Nested subroutines – what is value?Generic, Template and Pre-processed (Text Substitution) forParametric Instances– Avoid Duplicate Algorithms to Operate on Different Types– Parametric PolymorphismGenerics and Templates in C and Java – Why?Why is Function/Procedure Nesting Going Away in ImperativeProcedural Languages? Or is it?– ambdas-to-donested-functions– 1-have-anysupport-for-local-functionsAsynchronous Exceptions and Events - Concepts Sam Siewert8

PLP Ch. 9OO Concepts and Requirements for OOP to be OO1. Classes2. Interfaces, Encapsulation, Public and Private3. Parametric Polymorphism and True Polymorphism withInheritance and Late Binding4. Constructors and Destructors5. Dynamic Method Binding and Class Refinement, Virtualand Pure Virtual Functions for Abstract and DerivedClasses6. Multiple Inheritance (Is it Necessary?) Sam Siewert9

Alternative Programming ModelsFunctional,LogicAndConcurrency Sam Siewert10

PLP Ch. 10What Makes Functional Programming DifferentLisp and Scheme––––––Key DifferencesFamiliarity with ExpressionsLet and Let*Lambda FunctionsRecursionExample Code from ClassLambda Calculus and History – Mathematical and TheoreticalBackgroundLazy Evaluation – Defer Evaluation as Long as PossibleCompared to Eager or Strict Evaluation (More Common InImperative Procedural Programming) Sam Siewert11

PLP Ch. 11Logic ProgrammingPROLOG PL – History and UsesPROLOG Examples from ClassHorn ClausesFacts and RulesForward Chaining and Backward ChainingTracing Sam Siewert12

PLP Ch. 12Concurrency Types– Non-deterministic (Simple, e.g. Multi-programming)– Fair (Scale Out)– Predictable to Deterministic (Real-Time)Concurrency as Language Feature– Java Concurrency– Ada TaskingConcurrency as a Library Feature and OS FeatureConcurrency Challenges––––Deadlock and LivelockProducer/ConsumerAtomic Operations and Message QueuesPriority Inversion (Can it Occur on a Fair Scheduler System?) Sam Siewert13

Hints Study Java, C , Lisp and Scheme Code ExamplesPresented in Class and PostedMake sure you Have Used Lisp and Scheme and Tested andUnderstood all Example Expressions and FunctionsMake sure you Have Used Prolog and Tested andUnderstood all Example DatabasesMake Sure You have read PLP with Emphasis on What WasDiscussed in ClassYou Can Bring 2-Sided Note Page to the ExamFormat is Same as Exam #1 Sam Siewert14

Take-AwaysStudying PL Organization – Syntax, Semantics and Design Has Value Because1.2.3.Makes You a Better Programmer (more insight) - Understanding how Interpreters and Compilers areImplementedMany Products that Scale Out or Up, Can use Command Lines and Scripting for Automation (E.g. UpdateOS Configuration Files on Every Server in Datacenter) – Built into SolutionEvery Project must SELECT a Programming Language (Selection Driven byAdvantages/Disadvantages and Problem Domain fit to PL Paradigm)Syntax Almost Always in BNF Formal Specification, E.g. Ada95, C Compiler or Interpreter Front-end (Flex and Bison – Spec to Implementation)Semantics Requires Code Generation (Compiler) or InterpretationProgramming Language Specifications (Reference, Manual, Formal)1.2.3.4. Semantics Sometimes by Reference, in LRM, but also FormalReference Implementation [Error Prone], but with Formal BNF [Better], E.g. GCC for C and C Language Reference Manual [Better], E.g. Ada83, Ada95, C , JavaFormal Specification [Best – E.g. Denotational Semantics – RD Tennent, Operational Semantics,Axiomatic Semantics]E.g. Scheme R5RS, R6RS Denotational SemanticsAda83 – “Towards a Formal Description of Ada”, Lecture Notes in Computer Science, 1980.C Denotational Semantics – “Denotational Semantics of ANSI C”, Nikolaos S. Papaspyrou,Computer Standards and Interfaces, 2000.Java Denotational Semantics – “Dynamic Denotational Semantics of Java”, Jim Alves-Fossand Fong Shing Lam, Lecture Notes in Computer Science, 1998. Sam Siewert15

Formal Specification [Best – E.g. Denotational Semantics– RD Tennent, Operational Semantics, Axiomatic Semantics] E.g. Scheme R5RS, R6RS Denotational Semantics Ada83 – “Towards a Formal Description of Ada”, Lecture Notes in Computer Science, 1980. C Denotational Semantics

Related Documents:

HERB'S YELLOW CABS 1624-3330 10018 100 St Peace River \624-3334 Hiebert Andrew 332-4912 Hill Richard 332-4529 Hodgson Mrs B 332-4446 Hoecherl F S 332-4469 Hoel Garland »2-4324 Hogg Ralph 332-4470 Houlder H J Bud 332-4575 Houider Ken 332-4435 Htynyk George

Enganche Instrucciones de montaje y de servicio . 332 273 600 001 Nisan Cabstar (406) Renault Maxity. 332 273 691 101 - 007 2 . 332 273 691 101 - 007 3 D sich bitte direkt an Ihren Vertragspar Unsere Produkte werden mit größter Sorgfalt gefertigt.

The Income Tax Act [CAP. 332 R.E 2019] 1 THE UNITED REPUBLIC OF TANZANIA CHAPTER 332 THE INCOME TAX ACT [PRINCIPAL LEGISLATION] REVISED EDITION 2019 This Edition of the Income Tax Act, Cap. 332, has been revised up to and including 30th November, 2019 and is printed under the au

ACI 117 is adopted within the text of ACI 332 Note: Concrete construction in one and two-family dwellings should meet the standards established in ACI 332. Construction means, materials, or methods not addressed in ACI 332 should meet the standards established in ACI 318. Foundation Design: Continuou

The attached Tables using the ACI 332 table only reference 8" flat wall foundations. ACI 332-14 also has vertical rebar tables for higher strength concrete. Refer to Fox Blocks CAD details 2-01 and 2-02 for reinforcement placement. When utilizing the alternative table R404.1.2(9) or ACI 332 rebar designs ensure

Programming is the key word here because you make the computer do what you want by programming it. Programming is like putting the soul inside a body. This book intends to teach you the basics of programming using GNU Smalltalk programming language. GNU Smalltalk is an implementation of the Smalltalk-80 programming language and

The C programming language was developed in the early 1980s. C was designed to add object-oriented programming techniques to the C language. Although C originally tended to be associated with systems programming, ithas evolved into a mature programming language that is well-suited for a wide variety of application programming.

The C programming language was developed in the early 1980s. C was designed to add object-oriented programming techniques to the C language. Although C originally tended to be associated with systems programming, it has evolved into a mature programming language that is well-suited for a wide variety of application programming.