Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ch. 6 - 8 Ch. 6 - 81 jcmt CSE 3302 Programming Languages CSE3302 Programming Languages (notes, notes, notes) Dr. Carter Tiernan.

Similar presentations


Presentation on theme: "Ch. 6 - 8 Ch. 6 - 81 jcmt CSE 3302 Programming Languages CSE3302 Programming Languages (notes, notes, notes) Dr. Carter Tiernan."— Presentation transcript:

1 Ch. 6 - 8 Ch. 6 - 81 jcmt CSE 3302 CSE@UTA Programming Languages CSE3302 Programming Languages (notes, notes, notes) Dr. Carter Tiernan

2 Ch. 6 - 8 Ch. 6 - 82 jcmt CSE 3302 CSE@UTA Programming Languages Block Structured Languages: Activation records Fixed program part Variable activation-record part –Instruction part –Environment part Local context Nonlocal context

3 Ch. 6 - 8 Ch. 6 - 83 jcmt CSE 3302 CSE@UTA Programming Languages Nonlocal context Static link IP-EP locus of control Two coordinate access –Static distance –Offset Two step access

4 Ch. 6 - 8 Ch. 6 - 84 jcmt CSE 3302 CSE@UTA Programming Languages 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

5 Ch. 6 - 8 Ch. 6 - 85 jcmt CSE 3302 CSE@UTA Programming Languages 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

6 Ch. 6 - 8 Ch. 6 - 86 jcmt CSE 3302 CSE@UTA Programming Languages 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

7 Ch. 6 - 8 Ch. 6 - 87 jcmt CSE 3302 CSE@UTA Programming Languages Blocks Handled like degenerate procedures Activation records very important in language implementation Two-coordinate addressing is also significant Concepts

8 Ch. 6 - 8 Ch. 6 - 88 jcmt CSE 3302 CSE@UTA Programming Languages 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

9 Ch. 6 - 8 Ch. 6 - 89 jcmt CSE 3302 CSE@UTA Programming Languages Ada Highlights Abstract Data Types –Information Hiding (D. L. Parnas) Verification Concurrency Generally uses Pascal as basis

10 Ch. 6 - 8 Ch. 6 - 810 jcmt CSE 3302 CSE@UTA Programming Languages 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

11 Ch. 6 - 8 Ch. 6 - 811 jcmt CSE 3302 CSE@UTA Programming Languages Ada Declarations Object (constants and variables) Type Subprogram (procedures, functions and overloaded operators) Package (executable modules) Task (concurrently executable modules)

12 Ch. 6 - 8 Ch. 6 - 812 jcmt CSE 3302 CSE@UTA Programming Languages Ada: Data Structures Based on Pascal –Range constraints –Accuracy constraints: digits, delta –Discriminant constraint –Index constraint Name equivalence –Subtype, derived type Overloaded enumerations

13 Ch. 6 - 8 Ch. 6 - 813 jcmt CSE 3302 CSE@UTA Programming Languages Ada: Name structures Variables can be initialized at declaration Constants are declared with keyword and are constant within scope Separation of ‘interface’ & ‘implementation’

14 Ch. 6 - 8 Ch. 6 - 814 jcmt CSE 3302 CSE@UTA Programming Languages 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.

15 Ch. 6 - 8 Ch. 6 - 815 jcmt CSE 3302 CSE@UTA Programming Languages 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 With

16 Ch. 6 - 8 Ch. 6 - 816 jcmt CSE 3302 CSE@UTA Programming Languages Ada Packages ADT Library of routines Shared data structure Generic packages –ADT templates –Parameters Internal vs. External representations

17 Ch. 6 - 8 Ch. 6 - 817 jcmt CSE 3302 CSE@UTA Programming Languages Ada: Control Structures Iterator - loop end loop –Infinite loop - uses ‘exit’ keyword or ‘exit when’ –‘while’ phrase prefix –‘for’ phrase prefix Conditional - if then end if Case Subprograms Goto Exception handling Concurrency control

18 Ch. 6 - 8 Ch. 6 - 818 jcmt CSE 3302 CSE@UTA Programming Languages 4th Generation Languages Data abstraction languages Control structure for concurrency Refinement and correction of 3rd gen


Download ppt "Ch. 6 - 8 Ch. 6 - 81 jcmt CSE 3302 Programming Languages CSE3302 Programming Languages (notes, notes, notes) Dr. Carter Tiernan."

Similar presentations


Ads by Google