FORTRAN FORmula TRANslator -Anand Trivedi. HISTORY  Designed and written from scratch in 1954- 57 by an IBM team lead by John W. Backus as the first.

Slides:



Advertisements
Similar presentations
Overview of programming in C C is a fast, efficient, flexible programming language Paradigm: C is procedural (like Fortran, Pascal), not object oriented.
Advertisements

Programming Languages and Paradigms The C Programming Language.
Fortran Jordan Martin Steven Devine. Background Developed by IBM in the 1950s Designed for use in scientific and engineering fields Originally written.
Single Variable and a Lot of Variables The declaration int k; float f; reserve one single integer variable called k and one single floating point variable.
Chapter 2: Using Objects Part 1. To learn about variables To understand the concepts of classes and objects To be able to call methods To learn about.
CS 415: Programming Languages Algol Aaron Bloomfield Fall 2005.
Imperative Programming The Case of FORTRAN ICOM 4036 Lecture 4.
Kernighan/Ritchie: Kelley/Pohl:
ICE1341 Programming Languages Spring 2005 Lecture #14 Lecture #14 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University.
C++ Basics Prof. Shermane Austin. Learning Programming Language Basics Data Types – simple Expressions Relational and Logical Operators Conditional Statements.
ALGOL 60 Design by committee of computer scientists: Naur, Backus, Bauer, McCarthy, van Wijngaarden, Landin, etc. Design by committee of computer scientists:
Differences between Java and C CS-2303, C-Term Differences between Java and C CS-2303, System Programming Concepts (Slides include materials from.
FORTRAN. The History of Fortran Before Fortran there was a dark computing abyss Before Fortran there was a dark computing abyss Assembly was the only.
Introduction to Fortran Fortran Evolution Drawbacks of FORTRAN 77 Fortran 90 New features Advantages of Additions.
Fortran 9x HTML version. New F90 features Free source form Modules User-defined data types and operators Generic user-defined procedures Interface blocks.
Chapter 3 Program translation1 Chapt. 3 Language Translation Syntax and Semantics Translation phases Formal translation models.
Lecture 1 : January 2001 Dr. Andrew Paul Myers
FORTRAN.  Fortran or FORmula TRANslation was developed in the 1950's by IBM as an alternative to Assembly Language. First successfull high level language.
CS241 PASCAL I - Control Structures1 PASCAL I - Control Structures Philip Fees CS241.
JavaScript, Third Edition
Program A computer program (also software, or just a program) is a sequence of instructions written in a sequence to perform a specified task with a computer.
Presented by: Destry Diefenbach
Introduction to FORTRAN
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Imperative Programming
A Variable is symbolic name that can be given different values. Variables are stored in particular places in the computer ‘s memory. When a variable is.
Fortran 1- Basics Chapters 1-2 in your Fortran book.
April 14, ICE 1341 – Programming Languages (Lecture #13) In-Young Ko Programming Languages (ICE 1341) Lecture #13 Programming Languages (ICE 1341)
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Class 3 Programming in Visual Basic. Class Objectives Learn about input/output Learn about strings Learn about subroutines Learn about arrays Learn about.
Simple Procedural Languages: FORTRAN and C Lecture 9: Dolores Zage.
Language Elements 1. Data Types 2 Floating Point (real) Single Precision Double Precision Decimal Fixed Point (integer) Byte Short Integer Long Numerical.
Program A computer program (also software, or just a program) is a sequence of instructions written in a sequence to perform a specified task with a computer.
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room A, Chris Hill, Room ,
Input, Output, and Processing
Computer Science 101 Introduction to Programming.
Class Review. Basic Unix Commands list files in a directory: ls list files in a directory: ls remove files: rm remove files: rm rename files: mv rename.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
D. M. Akbar Hussain: Department of Software & Media Technology 1 Compiler is tool: which translate notations from one system to another, usually from source.
Chapter 6 Programming Languages (1) Introduction to CS 1 st Semester, 2015 Sanghyun Park.
BASICS CONCEPTS OF ‘C’.  C Character Set C Character Set  Tokens in C Tokens in C  Constants Constants  Variables Variables  Global Variables Global.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Fortran 77 By Tanatorn Somboonvorakit, ID:
Some Fortran programming tips ATM 562 Fall 2015 Fovell (see also PDF file on class page) 1.
CS-1030 Dr. Mark L. Hornick 1 C++ Language Basic control statements and data types.
C++ Lecture 1 Friday, 4 July History of C++ l Built on top of C l C was developed in early 70s from B and BCPL l Object oriented programming paradigm.
I Power Higher Computing Software Development High Level Language Constructs.
CS241 PASCAL I - Control Structures1 PASCAL Control Structures Modified Slides of Philip Fees.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
 2003 Prentice Hall, Inc. All rights reserved. 1 IS 0020 Program Design and Software Tools Preprocessor Midterm Review Lecture 7 Feb 17, 2004.
FORTRAN History. FORTRAN - Interesting Facts n FORTRAN is the oldest Language actively in use today. n FORTRAN is still used for new software development.
Beginning Fortran Introduction 13 October 2009 *Black text on white background provided for easy printing.
Ch Ch jcmt CSE 3302 Programming Languages CSE3302 Programming Languages Dr. Carter Tiernan.
Java Basics. Tokens: 1.Keywords int test12 = 10, i; int TEst12 = 20; Int keyword is used to declare integer variables All Key words are lower case java.
Sudeshna Sarkar, IIT Kharagpur 1 Programming and Data Structure Sudeshna Sarkar Lecture 3.
Presentation By :- Nikhil R. Anande ( ) Electronic & Communication Engineering. 3 nd Year / 5 th Semester FACULTY GUIDE : RAHIUL PATEL SIR MICROCONTROLLER.
1 jcmt Summer 2003Programming Languages CSE3302 Programming Languages Summer 2003 Dr. Carter Tiernan.
Lecture 3: More Java Basics Michael Hsu CSULA. Recall From Lecture Two  Write a basic program in Java  The process of writing, compiling, and running.
Zuse’s Plankalkül – 1945 Never implemented Problems Zuse Solved
Topics Designing a Program Input, Processing, and Output
BASIC ELEMENTS OF A COMPUTER PROGRAM
Wel come.
Introduction to FORTRAN
Chapter 10 Programming Fundamentals with JavaScript
Topics Designing a Program Input, Processing, and Output
Topics Designing a Program Input, Processing, and Output
An Introduction to Programming with C++ Fifth Edition
Programming Languages and Paradigms
DATA TYPES AND OPERATIONS
REPETITION Why Repetition?
Presentation transcript:

FORTRAN FORmula TRANslator -Anand Trivedi

HISTORY  Designed and written from scratch in by an IBM team lead by John W. Backus as the first ever High Level Language  Direct competition with assembler compelled it to have a fast, well optimized code

INTRODUCTION  Fortran is a general purpose programming language, mainly intended for engineering & scientific computation  Browse over its most popular version Fortran –77(in 1977)

LEXICAL ASPECTS  Input format : Formerly Punch cardsPunch cards  Not a free format language  Column position rules : Col. 1 : Blank, or a "c" or "*" for comments Col. 2-5 : Statement label (optional) Col. 6 : Continuation of previous line (optional) Col : Statements Col : Sequence number (optional, rarely used today)  Delimiters : End of the line  Blank space ignored  Variable names of 1-6 characters (A-Z, 0-9). The first character must be a letter.

EXPRESSIONS  Arithmetic Operators : **, /, *, -, +  Relational Operators :.LT.,.LE.,.GE.,.GT.,.EQ., and.NE.  Logical Operators :.NOT.,.AND.,.OR.,.EQV.,.NEQV.  eg: logical a, b a =.TRUE. b = a.AND. 3.LT. 5/2  Arithmetic expressions are evaluated first, then relational operators, and finally logical operators

DATA TYPES-I  Six data types are explicitly permitted:  INTEGER (0,25,+25,-25)  REAL (-1.5,3E5, +.123E-3)  DOUBLE PRECISION (1D2, 6.89D-8)  COMPLEX ((-10,5), (.4E2,-.31E-1)  LOGICAL(.TRUE.,.FALSE.)  CHARACTER(‘Don’’t’, ’A1 PLC+/’)

DATA TYPES-II  Each variable has to be declared explicitly  Implicit rule : All variables starting with the letters i-n are integers and all others are real  CONSTANT : By using PARAMETER statement  eg. parameter (pi = )

SAMPLE EXAMPLE- I  program circle real r, area pi parameter (pi = ) C write & read statements for I/p O/p write (*,*) 'Give radius r:' read (*,*) r area = pi*r*r write (*,*) 'Area = ', area stop end

DATA TYPES-III  Supports multiple assignments : eg: data m,n/10,20/, x,y/2*2.5/ or data m/10/, n/20/, x/2.5/, y/2.5/

DATA TYPES : ARRAYS  The only complex data structure  Index starts from 1 onwards : INTEGER i(10), REAL a(12), REAL b(*)  However these are also valid : REAL b(0:19), REA: weird(-162:237)  Allows arrays of up to seven dimensions REAL a(3,5), REAL b(2,0:3)  By default values are not Zero.  Array values are not checked before being used.

CONTROL STATEMENTS-I  GOTO statement : GOTO label  IF statement : Arithmetic if : IF (e)s1,s2,s3 Eg. IF((A+B)*2)100,200,300 Logical if : IF(e)statement Eg.IF(A.LT.0.)a=0.0  IF-THEN-ELSE Statement : If (e) THEN [statements] Else [statements] END IF  Nested IF allowed

CONTROL STATEMENTS-II  CONTINUE  Just one type of loop : DO loop  eg integer i, n, sum n = 10 DO 10 i = 0, n,2 write(*,*) 'i =', i 10 CONTINUE  No recursion (static allocation)

FUNCTIONS  Inbuilt functions like : abs, sin, cos etc  Define own functions : real function r(m,t) real t,m r = 0.1*t * (m**2 + 14*m) if (r.LT. 0) r = 0.0 return end

SUBROUTINES  Makes language modular  No global variables. So subroutines helps to pass it. Eg : subroutine iswap (a, b) integer a, b c Local variables integer tmp tmp = a a = b b = tmp return end

CALL BY REFERENCE PARADIGM program callex integer m, n m = 1 n = 2 call iswap(m, n) write(*,*) m, n stop end subroutine iswap (a, b) integer a, b c Local variables integer tmp tmp = a a = b b = tmp return end Fortran follows call by reference paradigm. Eg.

FORMAT STATEMENT  Used for particular input or output format  The most common format code letters are:  A - text string  D - double precision numbers, exponent notation  E - real numbers, exponent notation  F - real numbers, fixed point format  I - integer  X - horizontal skip (space)  / - vertical skip (newline)

THINGS NOT COVERED  Input and Output concepts  Input and Output statements (READ, WRITE, PRINT, OPEN,CLOSE,INQUIRE..)  Format specifications (Numeric editing, Logical editing, Character editing..)

PRESENT APPLICATIONS  Cosmology, fusion research, surface physics, molecular dynamics….  Nasa’s Anisotropy probe (flown in 2000) used some legacy f-77 though mostly f-90  US geological survey still uses f-77!...

PRESENT & FUTURE  F-90 has free format, dynamic allocation and pointers, user defined data type, modules, recursive functions, built-in arrays & operator overloading.  Fortran 2000 (delayed to 2004) hopes to have object orientation, interoperability with C, asynchronous I/o and lot more

REFERENCES       Fortran-77 - Harry Katzan  Structured Fortran77 Programming - Seymour Pollack