Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
F (programming language)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Programming language: compiled, structured, array language}} {{Distinguish|F Sharp (programming language){{!}}F#|F* (programming language)}} {{Infobox programming language | name = F language | developer = [[The Fortran Company]] | paradigm = [[Array programming|Array]], [[procedural programming|procedural]], [[modular programming|modular]] | typing = [[Type system|static]], [[Manifest typing|manifest]] | influenced_by = [[Fortran 95]] }} '''F''' is a [[modular programming|modular]], compiled, numeric programming language, designed for [[computational science|scientific programming]] and scientific computation.<ref name="js">{{cite web | url = http://www.fortran.com/F/about_f.html | title = All About F | author = The Fortran Company | accessdate = 2014-04-28 | archive-date = 2019-04-20 | archive-url = https://web.archive.org/web/20190420041840/http://www.fortran.com/F/about_f.html | url-status = dead }}</ref> F was developed as a modern [[Fortran]], thus making it a subset of [[Fortran 95]].<ref name="sc">{{cite web | url = https://www.cisl.ucar.edu/zine/96/fall/articles/2.F.language.html | title = The F Language | first = Jeanne| last = Adams | archive-url = https://web.archive.org/web/20140424064256/https://www.cisl.ucar.edu/zine/96/fall/articles/2.F.language.html |authorlink1=Jeanne Clare Adams | accessdate = 2014-04-28| archive-date = 2014-04-24 }}</ref> 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. == Overview == F is designed to be a minimal subset of Fortran, with only about one hundred intrinsic procedures.<ref name="de">{{cite web |url=https://www.fortran.com/F/java.htm |title=The F Programming Language Tastes Like Java |author1=Walt Brainerd |author2=David Epstein |author3=Richard Hendrickson |accessdate=2014-04-29 |archive-date=2016-12-10 |archive-url=https://web.archive.org/web/20161210170923/http://www.fortran.com/F/java.htm |url-status=dead }}</ref> 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]]/[[Fortran 95|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: * Arithmetic operators: <code>+</code>, <code>-</code>, <code>*</code>, <code>/</code>, <code>**</code> * Relational operators: <code><</code>, <code><=</code>, <code>==</code>, <code>/=</code>, <code>></code>, <code>>=</code> * Logical operators: <code>.not.</code>, <code>.and.</code>, <code>.or.</code>, <code>.eqv.</code>, <code>.neqv.</code> * character concatenation: <code>//</code> The assignment operator is denoted by the equal sign <code>=</code>. In addition, pointer assignment is denoted by <code>=></code>. Comments are denoted by the <code>!</code> symbol: <syntaxhighlight lang= "fortran"> variable = expression ! assignment pointer => target ! pointer assignment </syntaxhighlight> ===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.<ref name="sc"/> 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: <syntaxhighlight lang = "fortran"> ! 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 </syntaxhighlight> F does not have intrinsic support for [[object-oriented programming]], but it does allow for [[record (computer science)|records]]:<ref name="sc"/> <syntaxhighlight lang ="fortran"> type, public :: City character (len = 100) :: name character (len = 50) :: state end type City </syntaxhighlight> Variable declarations are followed by an attribute list. The attributes allowed are <code>parameter</code>, <code>public</code>, <code>private</code>, <code>allocatable</code>, <code>dimension</code>, <code>intent</code>, <code>optional</code>, <code>[[pointer (computer programming)|pointer]]</code>, <code>save</code> and <code>target</code>. The attribute list is followed by <code>::</code>, 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]]: <code>if</code>, a basic [[conditional (computer programming)|conditional]], <code>case</code>, a [[switch statement]], and <code>do</code>, a conditional [[while loop]]. The <code>return</code>, <code>stop</code>, <code>cycle</code>, and <code>exit</code> statements from Fortran may be used to break control flow. <syntaxhighlight lang = "fortran"> real :: x do i = 100 x = x+i print*,i cycle end do max : do if (x > y) then exit max end if x = y end do max stop if (x < y) then x = x + y else if ( x > y) then x = y - x end if select case (maximum): case (0) x = 0 case (1) x = 1 case (5) x = 5 case default x = 10 end select </syntaxhighlight> F places a heavy emphasis on [[modular programming]]. <syntaxhighlight lang = "fortran"> program main ! Insert code here end program main </syntaxhighlight> 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.<ref name="sc"/> F supports [[recursion (computer science)|recursion]]. All of the intrinsic procedures found in Fortran 95 may be used in F, with the exceptions of <code>achar</code>, <code>iachar</code>, <code>lge</code>, <code>lgt</code>, <code>lle</code>, <code>llt</code>, <code>transfer</code>, <code>dble</code>, <code>dim</code>, <code>dprod</code>, and <code>mod</code>. == References == {{Reflist}} == Bibliography == * Walter S. Brainerd, Charles H. Goldberg, and Jeanne C. Adams: "Programmer's Guide to F", Unicomp, 1996. * {{cite book|url=https://link.springer.com/book/10.1007/978-1-4471-0989-1 |first=Wihelm |last=Gehrke |title=The F Language Guide |publisher=Springer |isbn=978-3-540-76165-5 |date=1997-05-30}} * Robin A. Vowels: "Algorithms and Data Structures in F and Fortran", Unicomp. * Loren Meissner: "Essential Fortran 90 & 95", Unicomp, 1997. == External links == * [http://www.fortran.com/F/index.html F Programming Language Homepage] {{Webarchive|url=https://web.archive.org/web/20150109130310/http://www.fortran.com/F/index.html |date=2015-01-09 }} * [http://www.g95.org/ g95 compiler] {{Webarchive|url=https://web.archive.org/web/20130605121255/http://g95.org/ |date=2013-06-05 }} {{Authority control}} [[Category:Fortran programming language family]] [[Category:Programming languages]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Authority control
(
edit
)
Template:Cite book
(
edit
)
Template:Cite web
(
edit
)
Template:Distinguish
(
edit
)
Template:Infobox programming language
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Webarchive
(
edit
)