Make your own free website on Tripod.com

Project 2

Comparison and Contrast

Simple Procedural and Functional

Fortran and Scheme

 

History

Fortran and Scheme has both evolved from a newly developed language to a complete and powerful language. Fortran was first developed under environments where small, slow and relatively unreliable computers are used. These computers are used specifically for scientific computations and there is no existing efficient way of programming a computer. Now, Fortran is a credit as being the first compiled high level language.

The sequence of development for Fortran is outlined as below:

Fortran 0

Fortran 1 (1956)

Fortran II (1956)

FORTRAN IV (1958)

Fortran 77 (1978)

Fortran 90 (1992)

Scheme has evolved from a small language from which was used for teaching, support only a handful of syntactic forms and procedures. Now, Scheme is a general purpose programming language

 

Overview

Both FORTRAN and Scheme are high level language supporting operation on structured data such as strings, numbers and characters.

Fortran 90 contains new features such as built in functions, case statements and loop exit statements and a module family that allows data and subprogram declaration to be either private or public.

In the next version, Fortran 90 plans to get rid of it depreciated elements in the next version, e.g. IF and GO TO statements.

As for Scheme, Scheme programs are highly portable across implementations of the same Scheme system on different machines. Machine dependencies are almost completely hidden from the programmer.

 

Handling of Data Objects

FORTRAN and Scheme both support dynamic allocation and deallocation for data objects handling. FORTRAN uses dynamic arrays through the use of the ALLOCTABLE label and the ALLOCATE statement and DEALLOCATE for memory recovery. Objects in Scheme are dynamically allocated in heap where they are retained until no longer needed then automatically deallocated. On the other hand, FORTRAN also supports statistically bound arrays and subscripts. These arrays are initialized using the DATA statement.

 

Handling of Sequence Control

FORTRAN and Scheme both has their own unique way of synchronizing the sequence control in their programs. FORTRANS and Scheme both supports conditionals statements such as the IF statement and supports recursion and iteration in their own syntax. The only difference that I found is that FORTRAN does not support logical loops. FORTRAN 77 and FORTRAN 90 do not provide posttest or pretest logical loops as part of their language. These statements are constructed using DO loops, IF statements and GO TO exits. Scheme need only the IF statement to for logical loops. This IF statements posses as a pretest for the logical loops.

 

Subprograms and Storage Management

Subprograms in FORTRAN are created using FUNCTION and SUBROUTINE. These subprograms are usually given a name. As for Scheme, subprograms are created using the lambda syntactic form. The subprograms are in block structured and does not necessary to have a name. Identifiers in for subprograms in both languages can be bounded either locally or globally.

FORTRAN allows static or stack-dynamic allocation. Scheme supports dynamic allocation. For both languages, storage is reclaimed periodically. Scheme uses weak pairs and guardians to help with storage management while FORTRAN uses ALLOCATE statement and DEALLOCATE for memory recovery.

 

Abstraction and Encapsulation

In FORTRAN, all references to non-local variables were made possible through the COMMON blocks. These blocks that encapsulates and abstracts the data could be passed from one function to another as needed. In addition, FORTRAN allows user to derive types that are to be used.

Scheme uses syntactic extension that facilitates the definition of simple abstract of objects. Scheme has built-in procedures to process data. Unlike FORTRAN, Scheme does not support user-derived types.

 

 

 

 

 

 

 

Simple Procedural and Block Structured, Procedural

FORTRAN and Pascal

History

 

Overview

Both FORTRAN and Pascal are high level languages. Pascal allows hierarchial programming structure. Pascal's prominent feature is its ability for structured programming. Pascal programs are made up of smaller subprograms, which are structured programs themselves.

Handling of Data Objects

Both FORTRAN and Pascal required explicit data declaration at the beginning of the program of the subprogram.