Download
cse3302 programming languages notes notes notes n.
Skip this Video
Loading SlideShow in 5 Seconds..
CSE3302 Programming Languages (notes, notes, notes) PowerPoint Presentation
Download Presentation
CSE3302 Programming Languages (notes, notes, notes)

CSE3302 Programming Languages (notes, notes, notes)

179 Vues Download Presentation
Télécharger la présentation

CSE3302 Programming Languages (notes, notes, notes)

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. CSE3302Programming Languages(notes, notes, notes) Dr. Carter Tiernan Programming Languages

  2. Block Structured Languages: Activation records • Fixed program part • Variable activation-record part • Instruction part • Environment part • Local context • Nonlocal context Programming Languages

  3. Nonlocal context • Static link • IP-EP locus of control • Two coordinate access • Static distance • Offset • Two step access Programming Languages

  4. Procedure Activation • Needs static and dynamic links • Three steps • Save caller state • Create callee activation record • Enter callee in context of new record Procedure Deactivation • Two steps • Delete callee activation record • Restore the state of the caller Programming Languages

  5. Procedural Parameters • Two element record • IP gives entry address of actual procedure • EP gives pointer to environment of definition of procedure • Block structured languages generally only allow procedures to be passed in - not to be returned Programming Languages

  6. Nonlocal context • Static chains as discussed • Implemented as linked lists • Display • Random access to context • Array with pointers to activation records • Calls require saving display data • Shallow binding • Static activation records on stack Programming Languages

  7. Blocks • Handled like degenerate procedures Concepts • Activation records very important in language implementation • Two-coordinate addressing is also significant Programming Languages

  8. Ada Overview • Rationale • Software complexity and cost • Maintenance and portability • Government backing • History • 1975 - 79 Specifications • CII-Honeywell-Bull : Jean Ichbiah • Mil std and ANSI ‘83, ISO ‘87 Programming Languages

  9. Ada Highlights • Abstract Data Types • Information Hiding (D. L. Parnas) • Verification • Concurrency • Generally uses Pascal as basis Programming Languages

  10. Ada • Packages support info hiding and implement abstract data types • Specification of public names • Private body of package • Control structures include • Exception handling • Concurrent programming Programming Languages

  11. Ada Declarations • Object (constants and variables) • Type • Subprogram (procedures, functions and overloaded operators) • Package (executable modules) • Task (concurrently executable modules) Programming Languages

  12. Ada: Data Structures • Based on Pascal • Range constraints • Accuracy constraints: digits, delta • Discriminant constraint • Index constraint • Name equivalence • Subtype, derived type • Overloaded enumerations Programming Languages

  13. Ada: Name structures • Variables can be initialized at declaration • Constants are declared with keyword and are constant within scope • Separation of ‘interface’ & ‘implementation’ Programming Languages

  14. Ada Issues • “Global Variables Considered Harmful” Wulf & Shaw • Side effects • Indiscriminate access • Vulnerability • No overlapping definitions • Parnas’s principles of information hiding • One must provide the intended user with all the info needed to use the module correctly and nothing more. • One must provide the implementor with all the info needed to complete the module and nothing more. Programming Languages

  15. Name structures (cont.) • Packages • Interface specification • “public” part of package • May have “private” section • Body • Defines everything in interface specification • This is private to the package developer • Use <package_name> • With <package_name> Programming Languages

  16. Ada Packages • ADT • Library of routines • Shared data structure • Generic packages • ADT templates • Parameters • Internal vs. External representations Programming Languages

  17. Ada: Control Structures • Iterator - loop <body> end loop • Infinite loop - uses ‘exit’ keyword or ‘exit when’ • ‘while’ phrase prefix • ‘for’ phrase prefix • Conditional - if <condition>then <body>end if • Case • Subprograms • Goto • Exception handling • Concurrency control Programming Languages

  18. 4th Generation Languages 4th • Data abstraction languages • Control structure for concurrency • Refinement and correction of 3rd gen Programming Languages