Fortran

Izvor: Hrvatska internetska enciklopedija
Prijeđi na navigaciju Prijeđi na pretraživanje

Fortran (ili FORTRAN) ime je za proceduralni, imperativni programski jezik koji je bio razvijen tijekom 50-ih godina dvadesetog stoljeća, i koristi se većinom u znanstvene svrhe. Ime FORTRAN dobiveno je od skraćivanjem engleske složenice Formula Translation.

Povijest razvoja i inačice

Povijest razvoja

Prvi FORTRAN jezični prevoditelj (ili kompilator) razvila je tvrtka IBM za računalo IBM 704 između 1954. i 1957. godine. Razvojnu grupu predvodio je John W. Backus. Kao jezični prevoditelj FORTRAN je nastao u povojima računarstva tj. kada su osnovna svojstva računala bile veoma skromne (mala glavna memorija, spora centralna jedinica) tako da je razvojni tim imao skučeni prostor za razvoj i implementaciju.

Predvoditelj razvojne grupe John W. Backus je također bio i jedan od glavnih inženjera i dizajnera računala IBM 704, računala na kojem je razvijena prva inačica FORTRANA. Uz Backusa u razvojnoj grupi su sudjelovali su sljedeći programeri :

  • Sheldon F. Best
  • Harlan Herrick
  • Peter Sheridan
  • Roy Nutt
  • Robert Nelson
  • Irving Ziller
  • Richard Goldberg
  • Lois Haibt
  • David Sayre


Razvojni tim FORTRANA nije razvio princip programa-prevoditelja te prevođenje složenog programskog jezika u objektni kod, ali oni su prva grupa koja je razvila uspješan složeni programski jezik.

Inačice

  • FORTRAN I (1954-1957)
  • FORTRAN II (1958)
  • FORTRAN III (1958)
  • FORTRAN IV (1961)
  • FORTRAN 66 (1966)
  • FORTRAN 77 (1977)(ANSI standard)
  • FORTRAN 90 (1990)(ANSI standard)
  • FORTRAN 95 (1995)(ANSI standard)
  • FORTRAN 2000 (2000)
  • FORTRAN 2003 (2003)
  • FORTRAN 2008 (2008)

Posebitosti

Nedostaci

Programski primjer

<syntaxhighlight lang="fortran"> ! This program calculates the area of a tank, ! excluding the bottom. ! The variables are assigned as follows: ! ! R = RADIUS ! H = HEIGHT ! PI = 3.14159 ! A = AREA ! ! They are declared with the REAL statement below.

     REAL R, H, PI, A 
                                                                       
                                                                       

! The OPEN command associates the data file, "PANDAT.DAT", ! in folder "DATA" with logical device 5. If there is an ! error, statement 900 is executed.

     OPEN (5, FILE = 'C:\DATA\PANDAT.DAT', ACCESS = 'SEQUENTIAL',      &
     STATUS = 'OLD', ERR = 900)                                        
                                                                       
                                                                       

! This following section accumulates the sum of ! the input variables. ! The first command reads the data record and ! stores it in memory.

     DO	                                                                
        READ (5, FMT = 1, END = 99) R, H 
                                                                       

! The next command describes the form and location ! of the data to be read.

   1 FORMAT    (F4.2,F4.2) 
                                                                       

! The next statements assign values to the variables.

        PI = 3.14159 
        A = PI * R**2 + 2 * PI * R * H 
                                                                       

! The next section writes the sums to the screen. ! The first command, PRINT, denotes which FORMAT ! statement is to be used, and the variables to be printed.

        PRINT 11, H, R, A 
                                                                       

! The following FORMAT statement describes how the ! data field is to be written. Notice the semicolon in column 6 ! which is used to denote continuation of the previous line.

  11 FORMAT    (1X,'RADIUS= ',F6.2,10X,'HEIGHT= ',F6.1,10X,'AREA= ',   &
    &           F8.1)                                                  
                                                                       
                                                                       

! The following statement completes the loop.

     END DO 
                                                                       

! The next section prints if the input data is invalid.

 900 PRINT 21 
  21 FORMAT    (1X,'INVALID DATA') 
                                                                       
                                                                       

! Now we close the file and end program execution.

  99 CLOSE (5) 
     STOP 
     END                                           

</syntaxhighlight>

Vanjske poveznice

Povijest FORTRAN-a