1 / 21

CSE3302 Programming Languages (more notes)

CSE3302 Programming Languages (more notes). Dr. Carter Tiernan. Return 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

astrid
Download Presentation

CSE3302 Programming Languages (more notes)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. Return 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 debug Programming Languages

  3. Pascal • 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 implementation Programming Languages

  4. Pascal Structure • Syntax is Algol-like • Uses reserved words • New structures added • Name • Data • Control Programming Languages

  5. Data 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 implementation Programming Languages

  6. Data Structures, continued • Subrange types • Security and efficiency • Set types • Mathematical application • Efficient • Set operations defined - implemented with bit operations Programming Languages

  7. Arrays • 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 bounds Programming Languages

  8. Records • 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 with Programming Languages

  9. Arrays vs. Records Programming Languages

  10. Variant 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 accessible Programming Languages

  11. 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 eq Programming Languages

  12. Name Structures • Bindings • Constant • Type • Variable • Procedure and function • Implicit enumeration • Label Programming Languages

  13. Name Structures • Constants abstract out dependencies • Constants cannot be described by an expression • Expressions cannot be used in variable or type declarations Programming Languages

  14. Name 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 also Programming Languages

  15. Control 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 adoption Programming Languages

  16. Structures • for • Austere & even simpler than FORTRAN DO • while / do • Condition at beginning • repeat / until • Condition at end • case • Labeled cases Programming Languages

  17. Parameters • 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 problem Programming Languages

  18. Procedural 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 also Programming Languages

  19. Pascal • Excellent teaching language • Suitable for “real” programming • Usage goes beyond original intent Programming Languages

  20. Other 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 languages Programming Languages

  21. Third Generation Languages 3rd • Simplicity and efficiency • Data structures support applications • Support nesting • User definition • Pointers • Name structures have bindings for new types • Control structures are simplified and efficient • Case Programming Languages

More Related