# Fortran

**Fortran**（最初写作FORTRAN，是“公式翻译”的缩写）是一种编译型、静态强类型的编程语言，20世纪50年代由IBM为数值与科学计算而创造。1957年面向[IBM 704](https://www.edgepedia.org/zh/ibm-704)商业发布，它成为第一个国家级计算标准，至今仍活跃用于高性能计算、天气与气候模拟、计算流体力学和工程仿真。<sup>[1](https://www.ibm.com/history/fortran)</sup><sup> • </sup><sup>[2](https://fortran-lang.org/)</sup>

| 关键事实 | 详情 |
|---|---|
| 起源 | 1954年起在IBM创造；IBM数学公式翻译系统于1957年问世，首个面向IBM 704的编译器交付。<sup>[1](https://www.ibm.com/history/fortran)</sup><sup> • </sup><sup>[3](https://www.cs.man.ac.uk/CCS/res/pdfs/res41.pdf)</sup> |
| 主要作者 | 约翰·巴克斯（John Backus），他领导IBM团队，并把手工编码形容为“与机器肉搏”。<sup>[1](https://www.ibm.com/history/fortran)</sup> |
| 标准化 | 到20世纪60年代中期，Fortran已成为第一个国家级计算标准；现行标准为Fortran 2023（ISO/IEC 1539-1:2023），2023年11月发布。<sup>[1](https://www.ibm.com/history/fortran)</sup><sup> • </sup><sup>[4](https://wg5-fortran.org/f2023.html)</sup><sup> • </sup><sup>[5](https://www.iso.org/standard/82170.html)</sup> |
| 并行性 | 协数组（coarrays）于Fortran 2008标准化，并在2018和2023中扩展，以单程序多数据（SPMD）模型支持并行编程。<sup>[6](https://www.intel.com/content/www/us/en/docs/fortran-compiler/developer-guide-reference/2026-0/coarrays-001.html)</sup> |
| 与C互操作 | 自Fortran 2003起，`BIND(C)`属性提供了与C互操作的标准方式；Fortran数组默认起始下标为1，C数组为0。<sup>[7](https://gcc.gnu.org/onlinedocs/gfortran/Interoperability-with-C.html)</sup> |
| 编译器 | GNU Fortran完全实现Fortran 95标准，包含对旧版Fortran 77的支持，实现了Fortran 2003和2008的大部分内容，并部分支持Fortran 2018、初步支持Fortran 2023。<sup>[8](https://gcc.gnu.org/onlinedocs/gfortran/About-GNU-Fortran.html)</sup> |
| 现代角色 | Fortran是高性能计算的主导语言，被用来为世界上最快的超级计算机做基准测试。<sup>[2](https://fortran-lang.org/)</sup> |

## 源起IBM

20世纪50年代初，程序用手工以机器语言编写，程序员的成本通常至少与计算机本身相当；程序员最多有一半时间花在调试上。<sup>[1](https://www.ibm.com/history/fortran)</sup> Fortran的主要作者[约翰·巴克斯](https://www.edgepedia.org/zh/john-backus)提出，应创造一种语言，用类似数学记号的方式表达程序的意图，再让计算机去翻译。1953年，他获得预算，可以雇用一个小团队来检验这一想法是否可行，招聘广告上写着：“喜欢下棋或解谜的人会觉得这项工作引人入胜。”<sup>[1](https://www.ibm.com/history/fortran)</sup>

项目原计划六个月完成，实际花了三年。团队构成兼容并蓄：一位国际象棋高手、一位晶体学家（大卫·塞尔，David Sayre）、一位前美国国务院密码专家（罗伯特·纳尔逊，Robert Nelson）、一位从麻省理工学院（MIT）借调来的研究员（谢尔顿·贝斯特，Sheldon Best），以及洛伊丝·海布特（Lois Haibt）——她刚从[瓦萨学院](https://www.edgepedia.org/zh/vassar-college)（Vassar College）数学专业毕业便加入，构建了算术表达式分析器，即编译器的核心。<sup>[1](https://www.ibm.com/history/fortran)</sup> 哈兰·赫里克（Harlan Herrick）运行了第一个成功的Fortran程序，并被认为是`DO`语句和`GO TO`关键字的发明者。<sup>[1](https://www.ibm.com/history/fortran)</sup> 由于IBM 704——第一台批量生产、带高速磁芯存储器的计算机——机时稀缺，团队常常在夜间测试和调试代码。<sup>[1](https://www.ibm.com/history/fortran)</sup>

## 第一个编译器及其影响

IBM数学公式翻译系统，即Fortran，于1957年问世，IBM很快向IBM 704用户提供了第一个Fortran编译器。<sup>[1](https://www.ibm.com/history/fortran)</sup> 公开发布于1957年2月，首个编译器于当年4月交付。<sup>[3](https://www.cs.man.ac.uk/CCS/res/pdfs/res41.pdf)</sup>

编译器让那些坚称高级语言生成的代码永远比不过手工机器代码的怀疑者哑口无言：巴克斯的团队实现了第一个优化编译器，它把Fortran程序翻译成IBM 704的数值代码，运行速度几乎与任何手工打造的代码相当。<sup>[1](https://www.ibm.com/history/fortran)</sup> 生产率的提升是实实在在的。一个原本需要手动敲入多达一千条程序指令的问题，用Fortran可以缩减到47条语句。<sup>[1](https://www.ibm.com/history/fortran)</sup>

Fortran也开启了软件与硬件的分离。机器语言程序绑定于某一台特定机器，而用Fortran写的程序可以移植到任何配有Fortran编译器的计算机上。其他厂商也在自己的机器上采纳了IBM的标准，到20世纪60年代中期，Fortran已成为第一个国家级计算标准，用于美国大多数主要数据中心和欧洲部分地区。<sup>[1](https://www.ibm.com/history/fortran)</sup> 早期应用包括计算飞行中的导弹弹道和NASA飞行轨迹，以及计算经济与统计模型。<sup>[1](https://www.ibm.com/history/fortran)</sup>

## 标准历史

标准制定流程由[ISO/IEC JTC 1](https://www.edgepedia.org/zh/iso-iec-jtc-1)/SC 22的第5工作组（WG5）主持，美国Fortran委员会（INCITS/Fortran）是Fortran 95及以后标准的主要开发机构。<sup>[9](https://wg5-fortran.org/)</sup>

- **Fortran 77、90和95**引入了模块、可分配数组和数组处理，旨在让代码更接近数学形式，同时为编译器提供优化机会。<sup>[8](https://gcc.gnu.org/onlinedocs/gfortran/About-GNU-Fortran.html)</sup><sup> • </sup><sup>[10](https://fortran-lang.org/pl/learn/f95_features/array_handling/)</sup>
- **Fortran 2003**（ISO/IEC 1539-1:2004）通过`BIND(C)`属性标准化了与C的互操作，允许声明两种语言都可使用的过程、派生类型和全局变量。<sup>[7](https://gcc.gnu.org/onlinedocs/gfortran/Interoperability-with-C.html)</sup>
- **Fortran 2008**引入了用于并行编程的协数组和同步构造，并在Fortran 2018和2023中扩展。<sup>[6](https://www.intel.com/content/www/us/en/docs/fortran-compiler/developer-guide-reference/2026-0/coarrays-001.html)</sup>
- **Fortran 2018**（ISO/IEC 1539-1:2018）增加了更多并行特性，包括协数组程序的团队（teams）、事件（events）和集体操作（collectives）。<sup>[6](https://www.intel.com/content/www/us/en/docs/fortran-compiler/developer-guide-reference/2026-0/coarrays-001.html)</sup>
- **Fortran 2023**（ISO/IEC 1539-1:2023，第5版）于2023年11月17日发布。其新特性包括条件表达式、以度为单位的三角函数、`tokenize`和`split`内在子程序、枚举，以及长得多的源代码行：自由格式行上限提高到10,000字符，语句上限提高到一百万字符，面向机器生成的程序。<sup>[5](https://www.iso.org/standard/82170.html)</sup><sup> • </sup><sup>[11](https://wg5-fortran.org/N2201-N2250/N2212.pdf)</sup>

下一版修订——非正式称为Fortran 2028——的工作正在进行，委员会草案在筹备中。<sup>[9](https://wg5-fortran.org/)</sup>

## 语言特性与并行

Fortran从一开始就是为计算密集的科学与工程而设计的。它是静态强类型的，让编译器能尽早发现许多错误并生成高效的二进制代码，并支持命令式、过程式、面向数组、面向对象和函数式风格。<sup>[2](https://fortran-lang.org/)</sup> 对大数组表达算术几乎等同于直接书写数学，诸如`b = sqrt(a)`的整数组操作是语言的一部分。<sup>[2](https://fortran-lang.org/)</sup><sup> • </sup><sup>[10](https://fortran-lang.org/pl/learn/f95_features/array_handling/)</sup>

**协数组**用方括号中的尾随下标（称为协下标）扩展数组语法，以引用分布在映像（images）上的数据——映像是SPMD模型中程序的独立副本。含协数组的程序表现得就像被复制了固定次数，所有副本异步执行；映像数量在运行时、通过编译器选项或环境变量设定。<sup>[6](https://www.intel.com/content/www/us/en/docs/fortran-compiler/developer-guide-reference/2026-0/coarrays-001.html)</sup> 这让几乎相同的代码可以运行在单CPU、共享内存多核系统或分布式内存集群上。<sup>[2](https://fortran-lang.org/)</sup>

## 与C的互操作

自Fortran 2003起，有一套标准化机制涵盖与C互操作的过程、派生类型和全局变量。并非所有特性都能双向映射：C的无符号整数和可变参数函数在Fortran中没有对应物。<sup>[7](https://gcc.gnu.org/onlinedocs/gfortran/Interoperability-with-C.html)</sup> 数组约定有两点不同：维度顺序相反，且Fortran默认下标从1开始，C从0开始，因此Fortran声明`A(n,m)`对应C中的`A[m][n]`，元素`A(i,j)`对应`A[j-1][i-1]`。<sup>[7](https://gcc.gnu.org/onlinedocs/gfortran/Interoperability-with-C.html)</sup>

## 编译器与生态

[GNU Fortran](https://www.edgepedia.org/zh/gnu-fortran)（gfortran）自GCC 4.0.0起成为[GNU编译器集合](https://www.edgepedia.org/zh/gnu-compiler-collection)的一部分，完全符合Fortran 95标准，包含对旧版[Fortran 77](https://www.edgepedia.org/zh/fortran-77)的支持，实现了Fortran 2003和2008的大部分特性、相当数量的Fortran 2018特性，并初步支持Fortran 2023，同时支持OpenMP和OpenACC并行化。<sup>[8](https://gcc.gnu.org/onlinedocs/gfortran/About-GNU-Fortran.html)</sup><sup> • </sup><sup>[12](https://gcc.gnu.org/fortran/)</sup> 英特尔的Fortran编译器同样记录了对Fortran 2023的支持，包括协数组的数组和新的IEEE_ARITHMETIC函数，如`IEEE_MAX`和`IEEE_MIN`。<sup>[13](https://www.intel.com/content/www/us/en/docs/fortran-compiler/developer-guide-reference/2025-0/conformance-compatibility-and-fortran-features.html)</sup> 社区工具包括Fortran包管理器（FPM）和一个进行中的标准库项目。<sup>[14](https://fpm.fortran-lang.org/)</sup>

## 当前使用

Fortran仍是高性能计算的主导语言，被用来为世界上最快的超级计算机做基准测试。<sup>[2](https://fortran-lang.org/)</sup> NASA的戈达德太空研究所（Goddard Institute for Space Studies）用Fortran 90开发其ModelE系列海气耦合气候模型，这些模型为国际气候评估所用的CMIP档案做出了贡献。<sup>[15](https://www.giss.nasa.gov/projects/gcm/)</sup> 气候模型普遍使用Fortran，是看重其计算效率。<sup>[16](https://appliedsciences.nasa.gov/sites/default/files/2021-10/Intro%20to%20Climate%20Q%26A%20Part%202.pdf)</sup> IBM自己的回顾指出，它继续用于[多普勒雷达](https://www.edgepedia.org/zh/doppler-radar)天气预报、大气与海洋研究，以及纳米颗粒、基因组、DNA和原子结构的模拟。<sup>[1](https://www.ibm.com/history/fortran)</sup> 2021年的一篇综述称Fortran是仍在使用的最古老的高级编程语言，也是计算密集型科学与工程应用的主导语言之一。<sup>[17](https://arxiv.org/abs/2109.07382)</sup>

## References

1. [Fortran, IBM History](https://www.ibm.com/history/fortran)
2. [The Fortran Programming Language, fortran-lang.org](https://fortran-lang.org/)
3. [Resurrection, issue 41, Computer Conservation Society (50th anniversary of Fortran)](https://www.cs.man.ac.uk/CCS/res/pdfs/res41.pdf)
4. [WG5 Fortran: Fortran 2023](https://wg5-fortran.org/f2023.html)
5. [ISO/IEC 1539-1:2023, Programming languages, Fortran, Part 1: Base language, ISO](https://www.iso.org/standard/82170.html)
6. [Coarrays, Intel Fortran Compiler Developer Guide and Reference](https://www.intel.com/content/www/us/en/docs/fortran-compiler/developer-guide-reference/2026-0/coarrays-001.html)
7. [Interoperability with C, The GNU Fortran Compiler](https://gcc.gnu.org/onlinedocs/gfortran/Interoperability-with-C.html)
8. [About GNU Fortran, The GNU Fortran Compiler](https://gcc.gnu.org/onlinedocs/gfortran/About-GNU-Fortran.html)
9. [WG5 Fortran Standards Home](https://wg5-fortran.org/)
10. [Array handling, Fortran Programming Language](https://fortran-lang.org/pl/learn/f95_features/array_handling/)
11. [John Reid, The New Features of Fortran 2023, WG5 N2212](https://wg5-fortran.org/N2201-N2250/N2212.pdf)
12. [GNU Fortran, GNU Project](https://gcc.gnu.org/fortran/)
13. [Conformance, Compatibility, and Fortran Features, Intel Fortran Compiler](https://www.intel.com/content/www/us/en/docs/fortran-compiler/developer-guide-reference/2025-0/conformance-compatibility-and-fortran-features.html)
14. [Fortran Package Manager](https://fpm.fortran-lang.org/)
15. [NASA GISS: Global Climate Modeling](https://www.giss.nasa.gov/projects/gcm/)
16. [Introduction to NASA Resources for Climate Change Applications, NASA Applied Sciences](https://appliedsciences.nasa.gov/sites/default/files/2021-10/Intro%20to%20Climate%20Q%26A%20Part%202.pdf)
17. [Toward Modern Fortran Tooling and a Thriving Developer Community, arXiv](https://arxiv.org/abs/2109.07382)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 30, 2026; Oct 15, 2026 · Edited: Oct 15, 2026; Oct 25, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 软件与编程 › Programming languages › Individual programming languages › C-family and imperative languages

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/fortran

English original: https://www.edgepedia.org/fortran
