FORTRAN 04 February 1999; CS655.

Slides:



Advertisements
Similar presentations
Chapt.2 Machine Architecture Impact of languages –Support – faster, more secure Primitive Operations –e.g. nested subroutine calls »Subroutines implemented.
Advertisements

ICE1341 Programming Languages Spring 2005 Lecture #13 Lecture #13 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University.
Programming Languages and Paradigms
CS 415: Programming Languages Algol Aaron Bloomfield Fall 2005.
Programming Languages Marjan Sirjani 2 2. Language Design Issues Design to Run efficiently : early languages Easy to write correctly : new languages.
CS ExCo Advanced in Topics Object-Oriented Programming.
ALGOL 60 Design by committee of computer scientists: Naur, Backus, Bauer, McCarthy, van Wijngaarden, Landin, etc. Design by committee of computer scientists:
Introduction to Fortran Fortran Evolution Drawbacks of FORTRAN 77 Fortran 90 New features Advantages of Additions.
Programming Languages: Design, Specification, and Implementation G Rob Strom September 14, 2006.
G. Levine Chapter 6 Chapter 6 Encapsulation –Why do we want encapsulation? Programmer friendliness- programmer need not know about these details –Easier.
The environment of the computation Declarations introduce names that denote entities. At execution-time, entities are bound to values or to locations:
6/27/2015G. Levine1 PROGRAMMING LANGUAGES Text: Programming Languages, Design and Implementation Pratt and Zelkowitz 4 th ed. Prentice-Hall.
Chapter 9: Subprogram Control
1 Run time vs. Compile time The compiler must generate code to handle issues that arise at run time Representation of various data types Procedure linkage.
1 Contents. 2 Run-Time Storage Organization 3 Static Allocation In many early languages, notably assembly and FORTRAN, all storage allocation is static.
© 2003 G. Drew Kessler and William M. Pottenger1 Subroutines (Part 1) CSE 262, Spring 2003.
The ALGOL Family Mason Vines CPSC425. Overview ALGOL 58 ALGOL 60 ALGOL 68 Success and Failure of ALGOL.
Imperative Programming
Names Variables Type Checking Strong Typing Type Compatibility 1.
1 Programming Languages B.J. Maclennan 2. Fortran: Emphasis on Efficiency.
1 Names, Scopes and Bindings Aaron Bloomfield CS 415 Fall
Basic Semantics Associating meaning with language entities.
Programming Languages and Paradigms Imperative Programming.
Ch. 5 Ch. 51 jcmt CSE 3302 Programming Languages CSE3302 Programming Languages (more notes) Dr. Carter Tiernan.
The Evolution of Programming Languages Day 2 Lecturer: Xiao Jia The Evolution of PLs1.
Copyright © 2006 The McGraw-Hill Companies, Inc. Basic Terminology Value-returning functions: –known as “non-void functions/methods” in C/C++/Java –called.
Ch. 5 Ch. 51 jcmt Summer 2003Programming Languages CSE3302 Programming Languages (more notes) Summer 2003 Dr. Carter Tiernan.
How to execute Program structure Variables name, keywords, binding, scope, lifetime Data types – type system – primitives, strings, arrays, hashes – pointers/references.
Constructs for Data Organization and Program Control, Scope, Binding, and Parameter Passing. Expression Evaluation.
Procedure Definitions and Semantics Procedures support control abstraction in programming languages. In most programming languages, a procedure is defined.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 330 Programming Language Structures Operational Semantics (Slides mainly.
1 jcmt Summer 2003Programming Languages CSE3302 Programming Languages Summer 2003 Dr. Carter Tiernan.
C-- by Aksel Gresvig. Outline ● What is C--? How does it work? ● What C-- is not ● Relationship to C ● What does it look like? Examples ● Elements of.
Code Generation Instruction Selection Higher level instruction -> Low level instruction Register Allocation Which register to assign to hold which items?
CSE3302 Programming Languages (notes continued)
Data Types In Text: Chapter 6.
Zuse’s Plankalkül – 1945 Never implemented Problems Zuse Solved
VBA - Excel VBA is Visual Basic for Applications
Type Checking Generalizes the concept of operands and operators to include subprograms and assignments Type checking is the activity of ensuring that the.
Principles ; P.F. Reynolds CS655.
Algol 60 John Cowan N Languages in N Months Meetup June 7, 2016
Implementing Subprograms
Introduction to Scheme
Ch. 7 Programming Languages
Chapter 10: Implementing Subprograms Sangho Ha
Final Review In Text: Chapters 1-3, 5-11,
Scope, Visibility, and Lifetime
Final Review In Text: Chapters 1-11,
Final Review In Text: Chapters 1-3, 5-10, 12,
Final Review In Text: Chapters 1-3, 5-10, 12,
CSC 533: Programming Languages Spring 2015
Final Review In Text: Chapters 1-3, 5-10,
Midterm Review In Text: Chapters 1-3, 5-9, 15.
Final Review In Text: Chapters 1-3, 5-10,
Midterm Review In Text: Chapters 1-3, 5-10, 15.
Subprograms In Text: Chapter 9.
Final Review In Text: Chapters 1-3, 5-12,
Final Review In Text: Chapters 1-3, 5-16.
Names and Binding In Text: Chapter 5.
Runtime Environments What is in the memory?.
Final Review In Text: Chapters 1-3, 5-16.
Midterm Review In Text: Chapters 1-3, 5-9, 15.
Midterm Review In Text: Chapters 1-3, 5-11, 15.
ICOM 4029 Fall 2003 Lecture 2 (Adapted from Prof. Necula UCB CS 164)
CSC 533: Programming Languages Spring 2018
CSC 533: Programming Languages Spring 2019
Types and Related Issues
Chapter 10 Def: The subprogram call and return operations of
Presentation transcript:

FORTRAN 04 February 1999; CS655

FORTRAN Concepts/Contributions Binding time Separate compilation Modules Retention (data) Initialization of data objects Strong/weak typing (FORTRAN definitely weak!) Auto declaration Operator overloading Aliasing (in common blocks) Coercion 04 February 1999; CS655

FORTRAN Design Considerations Underlying hardware Efficiency (time) direct translation to machine ops optimization DO loops array subscripting Efficiency (space) equivalence common flat structure (no recursion) 04 February 1999; CS655

FORTRAN & Design Principles Abstraction (control) Defense in depth (assigned, computed GOTO; DO loop) Structure (goto’s) Syntactic consistency (two goto types) Preservation of information (DO loop) Zero-one-infinity (array dims, identifier length) Regularity (strings are second class) 04 February 1999; CS655

FORTRAN: Interesting Problems Array subscripting limit of three dimensions limit on subscript expressions Parameter passing reference as implemented is dangerous (expr actuals) Computed/Assigned GOTO’s Syntax space compression combined with no key words DO 10 I = 1.10 DO 10 I = 1,10 04 February 1999; CS655

ALGOL60 04 February 1999; CS655

ALGOL was indeed an achievement ALGOL was indeed an achievement. It was a significant advance on most of its successors. --Alan Perlis 04 February 1999; CS655

ALGOL60 Design by committee -- US/Europe -- 1957 Goals: Machine independence Improve RE: FORTRAN's established flaws One standard to end "proliferation" of languages Model of Computation: Static block structure (gave additional control over name space) Recursion [multiple instances of same routine(s)] --birth of stack model 04 February 1999; CS655

ALGOL60 Contributions Declaratives: Named data objects Declared their types Determined storage in activation record (or what needed to be done at runtime) Bound name to that storage Allowed for initialization Block structure: scope, visibility, hiding Scope: range over which name is defined Visibility: set of names that have meaning Hiding: re-use of name (in new context) c.f. FORTRAN: - named the object - allocated fixed memory - provided for initialization 04 February 1999; CS655

ALGOL60 Contributions (2) Static vs dynamic referencing became an issue Static: meaning of non-local ref determined by static context Dynamic: meaning of non-local ref determined by dynamic call chain 04 February 1999; CS655

ALGOL60 Types Primitive types: Constructors: real, integer, boolean, strings (2nd class) no dub precision (for machine independence) no complex Constructors: arrays only arbitrary bounds arbitrary dimensions arbitrary subscripts includes functions and other array refs dynamic sizing on block entry Zero-one-infinity 04 February 1999; CS655

ALGOL60 Types (more) In general, declarations were required no auto declarations (except procedure formals, labels) Strong typing: The only operations allowed to be performed on a data object are those defined for objects of that type (one of many defs for strong typing. Others?) Many loopholes: labels and integers specifications and declarations 04 February 1999; CS655

ALGOL60 Imperatives Imperatives: Computational, control flow, no I/O assignment much more general than FORTRAN's fac:= IF x <= 1 THEN 1 ELSE x*fac(x-1) Control flow- Conditional had awkward inconsistency: IF ~ THEN s1 ELSE ~ -- s1 can't be cond'l --violates regularity 04 February 1999; CS655

ALGOL60 Oddities Conditional booleans odd: For loop -- very general IF IF IF a THEN b ELSE c THEN d ELSE f THEN g ELSE h < k For loop -- very general FOR i:= 3,7, 11 STEP 1 UNTIl 16, i/2 WHILE i >= 1, 2 STEP i UNTIL 32 DO ~ (generates: 3,7,1,12,13,14,15,16, 8,4,2,1,2,4,8,16,32) --user can modify loop indices (see Knuth) -- violates localized cost 04 February 1999; CS655

Switch (early case / switch statement) BEGIN switch status= in_air, take_off, landing, on_runway … i:= <integer value> goto status[i]; in_air: ... } no ordering req'mnts landing: ... } can be take_off: ... } anywhere END switch s = L, IF j > 0 THEN M ELSE N, Q goto s[i]; -- dest depends on j if i=2. -- out of range treated as fall-through Switch - supports labeling - violates structure & security Designational expression See Knuth for some gems (e.g. p. 617). 04 February 1999; CS655

Example from Knuth: Switch 04 February 1999; CS655

Name Parameter Passing PROCEDURE swap (x, y); integer x, y; BEGIN INTEGER t; t:= x; x:= y; y:= t; END swap (i,j) -- works (x:i, y:j) swap (A[i],i) -- works (x:A[i], y:i) swap (i,A[i]) -- doesn't work! (x:i, y:A[i]) -- Similarly, Knuth claims you can't write a general successor function. -- Why? 04 February 1999; CS655

Jensen’s Device real procedure SUM (EXPR, INDEX, LB, UB); value LB, UB; real EXPR; integer INDEX, LB, UB; begin real TEMP; TEMP := 0; for INDEX := LB step 1 until UB do TEMP:= TEMP + EXPR; SUM:= TEMP end proc SUM; SUM(A[I], I, 1, 25); Manifest interface??? SUM (SUM(B[I,J], J, 1, N), I, 1, M) -- How many calls to SUM? 04 February 1999; CS655

Undesirable Interactions BEGIN INTEGER max, m, n; READ (max); FOR i:= 1 UNTIL max DO READ (m,n); OWN REAL ARRAY a[1:m, 1:n]; --Storage? ... <operations on a> END How can we deal with changing bounds while trying to keep a copy of "a" around between block entries? 04 February 1999; CS655