F (programming language)

Last updated
F language
Paradigm Array, procedural, modular
Developer The Fortran Company
Typing discipline static, manifest
Influenced by
Fortran 95

F is a modular, compiled, numeric programming language, designed for scientific programming and scientific computation. [1] F was developed as a modern Fortran, thus making it a subset of Fortran 95. [2] It combines both numerical and data abstraction features from these languages. F is also backwards compatible with Fortran 77, allowing calls to Fortran 77 programs. F was implemented on top of compilers from NAG, Fujitsu, Salford Software and Absoft. It was later included in the g95 compiler.

Contents

Overview

F is designed to be a minimal subset of Fortran, with only about one hundred intrinsic procedures. [3] Language keywords and intrinsic function names are reserved keywords in F and no other names may take this exact form. F contains the same character set used in Fortran 90/95 with a limit of 132 characters. Reserved words are always written in lowercase. Any uppercase letter may appear in a character constant. Variable names do not have restriction and can include upper and lowercase characters.

Operators

F supports many of the standard operators used in Fortran. The operators supported by F are:

The assignment operator is denoted by the equal sign =. In addition, pointer assignment is denoted by =>. Comments are denoted by the ! symbol:

variable=expression! assignment pointer=>target! pointer assignment

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] F provides the same types as Fortran, except that double precision floating point variables must be declared as real with a kind with a kind parameter:

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

F does not have intrinsic support for object-oriented programming, but it does allow for records: [2]

type,public::Citycharacter(len=100)::namecharacter(len=50)::stateend type City

Variable declarations are followed by an attribute list. The attributes allowed are parameter, public, private, allocatable, dimension, intent, optional, pointer , save and target. The attribute list is followed by ::, which is part of the syntax. F also allows for optional initialization in the list of objects. All items in a list will have the same attributes in a given type declaration statement. In addition, declarations are attribute oriented instead of entity oriented.

Statement and control flow

F supports 3 statements for control flow: if, a basic conditional, case, a switch statement, and do, a conditional while loop. The return, stop, cycle, and exit statements from Fortran may be used to break control flow.

real::xdo i=100x=x+iprint*,icycleend domax:do   if(x>y)then      exit maxend ifx=yend do maxstopif(x<y)thenx=x+yelse if(x>y)thenx=y-xend ifselect case(maximum):case(0)x=0case(1)x=1case(5)x=5case defaultx=10end select

F places a heavy emphasis on modular programming.

program main! Insert code hereend program main

Placing procedures outside of a module is prohibited. F supports most of the functions and subroutines found in the Fortran 95 standard library. All functions in F are external by default and require a result clause that returns the value of a function. [2] F supports recursion.

All of the intrinsic procedures found in Fortran 95 may be used in F, with the exceptions of achar, iachar, lge, lgt, lle, llt, transfer, dble, dim, dprod, and mod.

Related Research Articles

C is a general-purpose programming language. It was created in the 1970s by Dennis Ritchie and remains very widely used and influential. By design, C's features cleanly reflect the capabilities of the targeted CPUs. It has found lasting use in operating systems code, device drivers, and protocol stacks, but its use in application software has been decreasing. C is commonly used on computer architectures that range from the largest supercomputers to the smallest microcontrollers and embedded systems.

<span class="mw-page-title-main">Fortran</span> General-purpose programming language

Fortran is a third generation, compiled, imperative programming language that is especially suited to numeric computation and scientific computing.

PL/I is a procedural, imperative computer programming language initially developed by IBM. It is designed for scientific, engineering, business and system programming. It has been in continuous use by academic, commercial and industrial organizations since it was introduced in the 1960s.

In computer programming, a parameter or a formal argument is a special kind of variable used in a subroutine to refer to one of the pieces of data provided as input to the subroutine. These pieces of data are the values of the arguments with which the subroutine is going to be called/invoked. An ordered list of parameters is usually included in the definition of a subroutine, so that, each time the subroutine is called, its arguments for that call are evaluated, and the resulting values can be assigned to the corresponding parameters.

In computer programming, an assignment statement sets and/or re-sets the value stored in the storage location(s) denoted by a variable name; in other words, it copies a value into the variable. In most imperative programming languages, the assignment statement is a fundamental construct.

<span class="mw-page-title-main">C syntax</span> Set of rules defining correctly structured programs

The syntax of the C programming language is the set of rules governing writing of software in C. It is designed to allow for programs that are extremely terse, have a close relationship with the resulting object code, and yet provide relatively high-level data abstraction. C was the first widely successful high-level language for portable operating-system development.

<span class="mw-page-title-main">Pointer (computer programming)</span> Object which stores memory addresses in a computer program

In computer science, a pointer is an object in many programming languages that stores a memory address. This can be that of another value located in computer memory, or in some cases, that of memory-mapped computer hardware. A pointer references a location in memory, and obtaining the value stored at that location is known as dereferencing the pointer. As an analogy, a page number in a book's index could be considered a pointer to the corresponding page; dereferencing such a pointer would be done by flipping to the page with the given page number and reading the text found on that page. The actual format and content of a pointer variable is dependent on the underlying computer architecture.

<span class="mw-page-title-main">Conditional (computer programming)</span> Control flow statement that executes code according to some condition(s)

In computer science, conditionals are programming language constructs that perform different computations or actions or return different values depending on the value of a Boolean expression, called a condition.

In computer programming, the ternary conditional operator is a ternary operator that is part of the syntax for basic conditional expressions in several programming languages. It is commonly referred to as the conditional operator, ternary if, or inline if. An expression a ? b : c evaluates to b if the value of a is true, and otherwise to c. One can read it aloud as "if a then b otherwise c". The form a ? b : c is the most common, but alternative syntax do exist; for example, Raku uses the syntax a ?? b !! c to avoid confusion with the infix operators ? and !, whereas in Visual Basic .NET, it instead takes the form If(a, b, c).

In compiler construction, name mangling is a technique used to solve various problems caused by the need to resolve unique names for programming entities in many modern programming languages.

Coarray Fortran (CAF), formerly known as F--, started as an extension of Fortran 95/2003 for parallel processing created by Robert Numrich and John Reid in the 1990s. The Fortran 2008 standard now includes coarrays, as decided at the May 2005 meeting of the ISO Fortran Committee; the syntax in the Fortran 2008 standard is slightly different from the original CAF proposal.

In computer science, a relational operator is a programming language construct or operator that tests or defines some kind of relation between two entities. These include numerical equality and inequalities.

xHarbour is a free multi-platform extended Clipper compiler, offering multiple graphic terminals (GTs), including console drivers, GUIs, and hybrid console/GUIs. xHarbour is backward-compatible with Clipper and supports many language syntax extensions, greatly extended run-time libraries, and extensive third party support.

In some programming languages, const is a type qualifier that indicates that the data is read-only. While this can be used to declare constants, const in the C family of languages differs from similar constructs in other languages in that it is part of the type, and thus has complicated behavior when combined with pointers, references, composite data types, and type-checking. In other languages, the data is not in a single memory location, but copied at compile time for each use. Languages which use it include C, C++, D, JavaScript, Julia, and Rust.

The computer programming languages C and Pascal have similar times of origin, influences, and purposes. Both were used to design their own compilers early in their lifetimes. The original Pascal definition appeared in 1969 and a first compiler in 1970. The first version of C appeared in 1972.

C++11 is a version of the ISO/IEC 14882 standard for the C++ programming language. C++11 replaced the prior version of the C++ standard, called C++03, and was later replaced by C++14. The name follows the tradition of naming language versions by the publication year of the specification, though it was formerly named C++0x because it was expected to be published before 2010.

This is an overview of Fortran 95 language features. Included are the additional features of TR-15581:Enhanced Data Type Facilities, which have been universally implemented. Old features that have been superseded by new ones are not described – few of those historic features are used in modern programs although most have been retained in the language to maintain backward compatibility. The current standard is Fortran 2023; many of its new features are still being implemented in compilers.

This article describes the syntax of the C# programming language. The features described are compatible with .NET Framework and Mono.

This article compares a large number of programming languages by tabulating their data types, their expression, statement, and declaration syntax, and some common operating-system interfaces.

<span class="mw-page-title-main">Silverfrost FTN95</span>

Silverfrost FTN95: Fortran for Windows is a compiler for the Fortran programming language for computers running Microsoft Windows. It generates executable programs from human-written source code for native IA-32 Win32, x86-64 and for Microsoft's .NET platform. There is a free-of-charge Personal edition, which generates programs which briefly display a banner, and Commercial and Academic editions.

References

  1. The Fortran Company. "All About F". Archived from the original on 2019-04-20. Retrieved 2014-04-28.
  2. 1 2 3 4 Adams, Jeanne. "The F Language". Archived from the original on 2014-04-24. Retrieved 2014-04-28.
  3. Walt Brainerd; David Epstein; Richard Hendrickson. "The F Programming Language Tastes Like Java". Archived from the original on 2016-12-10. Retrieved 2014-04-29.

Bibliography