1- <!-- ===- docs/C++17.md
2-
1+ <!-- ===- docs/C++17.md
2+
33 Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44 See https://llvm.org/LICENSE.txt for license information.
55 SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6-
6+
77-->
88
9- # C++14/17 features used in f18
9+ # C++14/17 features used in Flang
1010
1111``` {contents}
1212---
@@ -27,7 +27,7 @@ out the details of how our C++ code should look and gives
2727guidance about feature usage.
2828
2929We have chosen to use some features of the recent C++17
30- language standard in f18 .
30+ language standard in Flang .
3131The most important of these are:
3232* sum types (discriminated unions) in the form of ` std::variant `
3333* ` using ` template parameter packs
@@ -41,7 +41,7 @@ in this list because it's not particularly well known.)
4141## Sum types
4242
4343First, some background information to explain the need for sum types
44- in f18 .
44+ in Flang .
4545
4646Fortran is notoriously problematic to lex and parse, as tokenization
4747depends on the state of the partial parse;
@@ -57,7 +57,7 @@ a unified lexer/parser.
5757We have chosen to do so because it is simpler and should reduce
5858both initial bugs and long-term maintenance.
5959
60- Specifically, f18 's parser uses the technique of recursive descent with
60+ Specifically, Flang 's parser uses the technique of recursive descent with
6161backtracking.
6262It is constructed as the incremental composition of pure parsing functions
6363that each, when given a context (location in the input stream plus some state),
@@ -73,7 +73,7 @@ of Fortran.
7373
7474The specification of Fortran uses a form of BNF with alternatives,
7575optional elements, sequences, and lists. Each of these constructs
76- in the Fortran grammar maps directly in the f18 parser to both
76+ in the Fortran grammar maps directly in Flang's parser to both
7777the means of combining other parsers as alternatives, &c., and to
7878the declarations of the parse tree data structures that represent
7979the results of successful parses.
@@ -87,10 +87,10 @@ The bounded polymorphism supplied by the C++17 `std::variant` fits
8787those needs exactly.
8888For example, production R502 in Fortran defines the top-level
8989program unit of Fortran as being a function, subroutine, module, &c.
90- The ` struct ProgramUnit ` in the f18 parse tree header file
90+ ` struct ProgramUnit ` in the Flang parse tree header file
9191represents each program unit with a member that is a ` std::variant `
9292over the six possibilities.
93- Similarly, the parser for that type in the f18 grammar has six alternatives,
93+ Similarly, the parser for that type in Flang's grammar has six alternatives,
9494each of which constructs an instance of ` ProgramUnit ` upon the result of
9595parsing a ` Module ` , ` FunctionSubprogram ` , and so on.
9696
@@ -99,7 +99,7 @@ parse is typically implemented with overloaded functions.
9999A function instantiated on ` ProgramUnit ` will use ` std::visit ` to
100100identify the right alternative and perform the right actions.
101101The call to ` std::visit ` must pass a visitor that can handle all
102- of the possibilities, and f18 will fail to build if one is missing.
102+ of the possibilities, and Flang will fail to build if one is missing.
103103
104104Were we unable to use ` std::variant ` directly, we would likely
105105have chosen to implement a local ` SumType ` replacement; in the
0 commit comments