Jump to content

F (programming language)

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Cnwilliams (talk | contribs) at 21:09, 1 May 2014 (Disambiguated: Real, Complex, Character, Pointer, Structs; Unlinked: Numeric, Private). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
F language
Paradigmmodule-oriented programming
Influenced
Fortran 95

F is a module-oriented, complied and numeric computer programming language. F is designed for scientific programming and scientific computation.[1] F was developed by the Fortran Company and was developed as a modern Fortran thus making it a subset of Fortran 95 and Fortran 90[2] programming language. It combines both numerical features and data abstraction features from these languages.F is also backwards compatibility thus allowing to make calls to Fortran 77 program. F uses the g95 compiler, which is the same compiler used for Fortran 95. F compilers are readily available on both Windows and various Linux Operating Systems free of charge or can be as part of a bundle from the Fortran Store. F is recommended as a beginning program language and for researchers designing new projects.[2]

Overview

F is not permissive thus there is only one way to write codes.[2] All key words and function names are reserved words in F therefore names cannot be the same as any keyword. F is equipped with more than one hundred intrinsic procedures built into it therefore does not need to include additional standard libraries or modules[3]

Data Types

Similar to Fortran, the type specification is made up of a type,a list of attributes for the declared variables, and the variable list.[2] The intrinsic types are:
integer
real
complex
character
logical

Variable declarations are followed by an attribute list. The attributes allowed are parameter, public, private, allocatable, dimension (dimension of array), intent, optional, pointer, save and target. The attribute list is followed by "::"" (double colons), which are part of the syntax. F also allows for optional initialization in the list of objects.
Example of the informal syntax of type declaration:

! type [,attribute list] :: entity declaration list
real :: x, y ! declaring variables of type real x,y without an attribute list
integer (kind = long), dimension (100) :: x ! declaring variable of type big integer array with the identifier x
 character (len = 100) :: student_name ! declaring a character type variable with len 100

Although F does is a module-oriented language and does not support classes, programmers may create their own user-defined type. User defined types are similar to Structs in C and C++, where the type is used to cohesively placed differently types of variables in a single structure.[2]

For example:

type, public :: City
     character (len = 100) :: name
     character (len = 50):: state
end type City

References

  1. ^ The Fortran Company. "All About F". Retrieved 2014-04-28.
  2. ^ a b c d e Jeanne Adams. "The F Language". Retrieved 2014-04-28. Cite error: The named reference "sc" was defined multiple times with different content (see the help page).
  3. ^ Walt Brainerd, David Epstein, Richard Hendrickson. "The F Programming Language Tastes Like Java". Retrieved 2014-04-29.{{cite web}}: CS1 maint: multiple names: authors list (link)