[flang-dev] Regarding main program structure
Rajesh K Singh via flang-dev
flang-dev at lists.llvm.org
Thu Oct 24 23:33:05 PDT 2019
Hello,
According to specification R1401, a Fortran main program *must* have an
“end statement” whereas other parts are optional.
// R1401 main-program ->
// [program-stmt] [specification-part] [execution-part]
// [internal-subprogram-part] end-program-stmt
Thus, the below case.f90 is a legitimate fortran program:
[user at localhost ~/F18]$ cat -n case.f90
1 end !only end-program-stmt is specified.
[user at localhost ~/F18]$
The implementation of MainProgram structure (“lib/parser/parse-tree.h”)
shows that only “ProgramStmt” and “InternalSubprogramPart” are optional.
struct MainProgram {
TUPLE_CLASS_BOILERPLATE(MainProgram);
std::tuple<std::optional<Statement<ProgramStmt>>, SpecificationPart,
ExecutionPart, std::optional<InternalSubprogramPart>,
Statement<EndProgramStmt>>
t;
};
Why “SpecificationPart” and “ExecutionPart” are not implemented as optional
(std::optional), while these are optional similar to “ProgramStmt” and
“InternalSubprogramPart”?
Thanks in anticipation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/flang-dev/attachments/20191025/d0b7e866/attachment.html>
More information about the flang-dev
mailing list