DOC PREVIEW
UT Arlington CSE 3302 - Lecture Notes

This preview shows page 1-2-3-24-25-26 out of 26 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CSE3302 Programming Languages (notes continued)Generality and Hierarchy: Algol-60Algol DesignAlgol: Name StructuresAlgol: BlocksDynamic ScopingStatic ScopingAlgol: Stacks for managementResponsible DesignAlgol: Data StructuresZero-One-Infinity PrincipleAlgol: ArraysAlgol: Control structuresAlgol: Control and nestingAlgol: More controlAlgol: Parameter passingAlgol: Pass by nameLanguage Design IssuesAlgol: Control (more)Algol: Control etal.Algol: Syntactic StructuresAlgol: LexicsBackus-Naur Form (BNF)BNFDesign CriteriaPowerPoint PresentationCSE 3302 CSE@UTA Programming LanguagesCh. 3 & 4Ch. 3 & 4 1 jcmtCSE3302CSE3302Programming LanguagesProgramming Languages(notes continued)(notes continued)Dr. Carter TiernanCSE 3302 CSE@UTA Programming LanguagesCh. 3 & 4Ch. 3 & 4 2 jcmtGenerality and Hierarchy:Generality and Hierarchy:Algol-60Algol-60•Close as possible to standard mathematical notation and readable•Usable for describing computing processes•Mechanically translatable to machine languageCSE 3302 CSE@UTA Programming LanguagesCh. 3 & 4Ch. 3 & 4 3 jcmtAlgol DesignAlgol Design•Hierarchical structure / Nesting–(unlike C & C++)•Declarative and Imperative constructs–Variable, procedure, and switch–Computational and control-flow•Compilation handled differently than Fortran•Stack for run-time structuresABCDCSE 3302 CSE@UTA Programming LanguagesCh. 3 & 4Ch. 3 & 4 4 jcmtAlgol: Name StructuresAlgol: Name Structures•Names are NOT statically bound•Block structure supports scoping–Blocks are compound statements with declarations•Scope - contour diagrams•Context–Inner blocks implicitly inherit access to variables in its immediately surrounding blockABCDCSE 3302 CSE@UTA Programming LanguagesCh. 3 & 4Ch. 3 & 4 5 jcmtAlgol: BlocksAlgol: Blocks•Allows shared data to be easily organized with the subprograms that need it (but does allow indiscriminate access)•Scoping choices–Static: called in the environment of its definition (used exclusively in Algol)–Dynamic: called in the environment of its callerCSE 3302 CSE@UTA Programming LanguagesCh. 3 & 4Ch. 3 & 4 6 jcmtDynamic ScopingDynamic Scoping•Called in environment of caller•Can write general procedures that make use of variables and procedures supplied by caller’s environment•Vulnerable to being called from an environment without correct supporting procedures•Not generally used in current languagesCSE 3302 CSE@UTA Programming LanguagesCh. 3 & 4Ch. 3 & 4 7 jcmtStatic ScopingStatic Scoping•Called in the environment of its definition•Requires the user to pass parameters of local environment•Cannot behave differently based on call location only•Ensures that the static structure of the program more closely agrees with the dynamic behavior of the program.CSE 3302 CSE@UTA Programming LanguagesCh. 3 & 4Ch. 3 & 4 8 jcmtAlgol: Stacks for managementAlgol: Stacks for management•Disjoint blocks allow conservation of memory on the stack–Assumption: a variable is retained only so long as the program is executing in the scope of that variable or in a block that will return to the scope of that variable•Blocks follow LIFO execution; ergo, a stack handles the activation records in a LIFO fashionDCAABCDCSE 3302 CSE@UTA Programming LanguagesCh. 3 & 4Ch. 3 & 4 9 jcmtResponsible DesignResponsible Design•Understand the programmers’ problem•Provide a high quality solution–Which is not necessarily the solution the programmers (or users) asked for•Responsible Design Principle–Caveat: If the user wants it and you don’t supply it (in their fashion), they may not accept your alternate (even if better) solutionCSE 3302 CSE@UTA Programming LanguagesCh. 3 & 4Ch. 3 & 4 10 jcmtAlgol: Data StructuresAlgol: Data Structures•Primitives are scalars–Boolean, integer, and real–No double precision because it’s machine dependent–No complex due to tradeoffs of usefulness vs. complexity–Limited string type that required procedures coded in some other language in order to be output or usedCSE 3302 CSE@UTA Programming LanguagesCh. 3 & 4Ch. 3 & 4 11 jcmtZero-One-Infinity PrincipleZero-One-Infinity Principle•Supports regularity - easier to learn, remember, and master•Eliminates arbitrary numerical limits•Applies to arrays in–Number of dimensions–Start and end values for indicesCSE 3302 CSE@UTA Programming LanguagesCh. 3 & 4Ch. 3 & 4 12 jcmtAlgol: ArraysAlgol: Arrays•Generalized •Dynamic due to stack allocationData TypesData Types•Strong typing•Coercions and conversions•Type system as “safety feature”CSE 3302 CSE@UTA Programming LanguagesCh. 3 & 4Ch. 3 & 4 13 jcmtAlgol: Control structuresAlgol: Control structures•Primitives–Assignment :=–No input/output - handled with library routines•Structures–Regularize the FORTRAN structures•if condition then statement1 else statement2•for initialization keyword test do statementCSE 3302 CSE@UTA Programming LanguagesCh. 3 & 4Ch. 3 & 4 14 jcmtAlgol: Control and nestingAlgol: Control and nesting•All control structures can handle arbitrary number of bracketed statements•Compound statements formed with begin and endAlgol structuring led to Dijkstra’s letter, “GOTO Considered Harmful”CSE 3302 CSE@UTA Programming LanguagesCh. 3 & 4Ch. 3 & 4 15 jcmtAlgol: More controlAlgol: More control•Hierarchical structure Structured programming•Recursion supported•Instantiation of locals–Every call creates a new activation recordConditional expressionCSE 3302 CSE@UTA Programming LanguagesCh. 3 & 4Ch. 3 & 4 16 jcmtAlgol: Parameter passingAlgol: Parameter passing•Passing by value–Local copy of parameter–Requires keyword value•Pass by name–Default mode–Based on substitution - Copy Rule–Not actually substituted for formal paramsCSE 3302 CSE@UTA Programming LanguagesCh. 3 & 4Ch. 3 & 4 17 jcmtAlgol: Pass by nameAlgol: Pass by name•Compare to pass by reference–Name parameters bound to string•Jensen’s device–Use pass by name with index variable to cycle through array elements•Implementation - thunk–Compile parameter–Pass address of compiled parameter code•Inconsistent behaviorCSE 3302 CSE@UTA Programming LanguagesCh. 3 & 4Ch. 3 & 4 18 jcmtLanguage Design IssuesLanguage Design Issues•GO TO controversy•Conceptual models–System image•Feature interactionCSE 3302 CSE@UTA Programming LanguagesCh. 3 & 4Ch. 3 & 4 19 jcmtAlgol: Control (more)Algol: Control (more)•Out of block


View Full Document

UT Arlington CSE 3302 - Lecture Notes

Documents in this Course
Smalltalk

Smalltalk

11 pages

Syntax

Syntax

5 pages

Syntax

Syntax

5 pages

JAVA

JAVA

57 pages

Semantics

Semantics

41 pages

Control

Control

74 pages

Load more
Download Lecture Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?