DOC PREVIEW
UT Arlington CSE 3302 - Programming Languages

This preview shows page 1-2-20-21 out of 21 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 21 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 21 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 21 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 21 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 21 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CSE3302 Programming Languages (more notes)Return to SimplicityPascalPascal StructureData StructuresData Structures, continuedArraysRecordsArrays vs. RecordsVariant RecordsData types (cont.)Name StructuresSlide 13Name Struct ConstructorsControl StructuresStructuresParametersProcedural parametersSlide 19PowerPoint PresentationThird Generation LanguagesCSE 3302 CSE@UTA Programming LanguagesCh. 5Ch. 5 1 jcmtCSE3302CSE3302Programming LanguagesProgramming Languages(more notes)(more notes)Dr. Carter TiernanCSE 3302 CSE@UTA Programming LanguagesCh. 5Ch. 5 2 jcmtReturn to SimplicityReturn to Simplicity•Attempts to extend Algol included:–PL /I •very large•intersection of FORTRAN, COBOL, and Algol•“Swiss army knife” approach–Extensible languages•Kernal: application independent•Ex: operator extensions & syntax macros•Inefficient; hard to debugCSE 3302 CSE@UTA Programming LanguagesCh. 5Ch. 5 3 jcmtPascalPascal•Niklaus Wirth designed successor languages to Algol•Goal was to compete with FORTRAN and keep the benefits of Algol•Explicit goals–Suitable for teaching programming–Reliable, efficient implementationCSE 3302 CSE@UTA Programming LanguagesCh. 5Ch. 5 4 jcmtPascal StructurePascal Structure•Syntax is Algol-like•Uses reserved words•New structures added–Name–Data–ControlCSE 3302 CSE@UTA Programming LanguagesCh. 5Ch. 5 5 jcmtData StructuresData Structures•Primitives–Real, integer, boolean from Algol–Characters : type char•Enumeration types–Replaces integer codes to represent lists–Limits range of values explicitly–Keeps types unique and separate –Defined as a binding construct–Only allows meaningful operations–Efficient implementationCSE 3302 CSE@UTA Programming LanguagesCh. 5Ch. 5 6 jcmtData Structures, continuedData Structures, continued•Subrange types–Security and efficiency•Set types–Mathematical application–Efficient–Set operations defined - implemented with bit operationsCSE 3302 CSE@UTA Programming LanguagesCh. 5Ch. 5 7 jcmtArraysArrays•Generalized index types (integer subranges)•Allowable element types - any other Pascal base type including other arrays, etc.•No multi dimensional arrays BUT can have an array whose element type is array and “syntactic sugar” allows appearance of multi-dim arrays•Restrictions on Pascal arrays–Static bounds : determinable at compile time–Dimensions are part of array type–Feature interaction problem with boundsCSE 3302 CSE@UTA Programming LanguagesCh. 5Ch. 5 8 jcmtRecordsRecords•Aggregate heterogeneous data–Components can be primitive types or complex data types including records and arrays–Component selection within a record is done with dot notation–with statement opens a record for accessing multiple fields within the block of the withCSE 3302 CSE@UTA Programming LanguagesCh. 5Ch. 5 9 jcmtArrays vs. RecordsArrays vs. RecordsStructure Element typesSelectorsArray HomogeneousDynamic (computable)Record HeterogeneousStaticCSE 3302 CSE@UTA Programming LanguagesCh. 5Ch. 5 10 jcmtVariant RecordsVariant Records•Groups different fields according to a status value•The status value is called the tag field•Creates a loophole related to type because variant fields do not have to be initialized and previous values of different type may be accessibleCSE 3302 CSE@UTA Programming LanguagesCh. 5Ch. 5 11 jcmtData types (cont.)Data types (cont.)•Pascal structures allow efficient information storage•Pascal has pointers–Pointers have data types to support strong typing in Pascal–Pointer base types can be any other type•Initially type equivalence was not clearly defined–Structural, Name (simpler and safer)–Subrange equivalence within Name eqCSE 3302 CSE@UTA Programming LanguagesCh. 5Ch. 5 12 jcmtName StructuresName Structures•Bindings–Constant–Type–Variable–Procedure and function–Implicit enumeration–LabelCSE 3302 CSE@UTA Programming LanguagesCh. 5Ch. 5 13 jcmtName StructuresName Structures•Constants abstract out dependencies•Constants cannot be described by an expression•Expressions cannot be used in variable or type declarationsCSE 3302 CSE@UTA Programming LanguagesCh. 5Ch. 5 14 jcmtName Struct ConstructorsName Struct Constructors•Records•Procedures–Much like Algol in format and scope–Order of declarations was important for one-pass compilation•Reverses top-down order•No way to define mutually recursive procs–forward declaration (like C prototype decl)•Group order important alsoCSE 3302 CSE@UTA Programming LanguagesCh. 5Ch. 5 15 jcmtControl StructuresControl Structures•More structures than Algol but simpler•I/O routines provided•Structured control is supported–One entry, one exit•Supports recursion•Has a goto to facilitate adoptionCSE 3302 CSE@UTA Programming LanguagesCh. 5Ch. 5 16 jcmtStructuresStructures•for–Austere & even simpler than FORTRAN DO•while / do–Condition at beginning•repeat / until–Condition at end•case–Labeled casesCSE 3302 CSE@UTA Programming LanguagesCh. 5Ch. 5 17 jcmtParametersParameters•Pass by reference•Pass by value•Pass by constant–Input parameter treated as a constant inside called routine–Compiler can either copy or pass address of parameter–Left loophole similar to aliasing problemCSE 3302 CSE@UTA Programming LanguagesCh. 5Ch. 5 18 jcmtProcedural parametersProcedural parameters•Can pass procedures and functions as parameters•Originally, formal specification gave procedure name and return type but not parameters of procedure being passed•Standard required parameters to be specified alsoCSE 3302 CSE@UTA Programming LanguagesCh. 5Ch. 5 19 jcmtPascalPascal•Excellent teaching language•Suitable for “real” programming•Usage goes beyond original intentCSE 3302 CSE@UTA Programming LanguagesCh. 5Ch. 5 20 jcmtOther LanguagesOther Languages•PL /I extensions•BCPL - Cambridge Plus London•B - BCPL based & used in 1st Unix (8k PDP-7)•C - successor of ‘B’ by Dennis Ritchie–Used to rewrite Unix kernel–Characteristics of 1st, 2nd, and 3rd gen languages•PL /I extensions•BCPL - Cambridge Plus London•B - BCPL based & used in 1st Unix (8k PDP-7)•C - successor of ‘B’ by Dennis Ritchie–Used to rewrite Unix kernel–Characteristics of 1st, 2nd, and 3rd gen languagesCSE 3302 CSE@UTA Programming LanguagesCh. 5Ch. 5 21 jcmtThird Generation LanguagesThird Generation Languages•Simplicity and efficiency•Data structures support


View Full Document

UT Arlington CSE 3302 - Programming Languages

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 Programming Languages
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 Programming Languages 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 Programming Languages 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?