Reputation: 4600
Is there a way to tell ifort or gfortran to just try to parse a source file (no include following, no compilation, no linking, etc) to tell us whether they find the syntax of the file acceptable / valid for a given Fortran version (77, 90, 95, ...) or at least valid at all?
I'm working on a piece of software that will parse and analyze Fortran source files, perform transformations on their semantic representation and generate new Fortran source code files as result.
Until my (standards-adherent) strict parser is ready to roll, I first plan to use a relaxed one. That relaxed parser
. That's why I would love to know whether, at the initial stages of this project, we could use delegate the work of strict syntactic validation to common compilers.
Upvotes: 1
Views: 848
Reputation: 54605
Did you try looking into the man page?
gfortran should support
-fsyntax-only //Check the code for syntax errors, but don't do anything beyond that.
ifortran should support
-fsyntax-only / -syntax-only / -y //all meaning the same
// Specifies that the source file should be checked only for correct syntax.
// No code is generated, no object file is produced, and some error checking done
// by the optimizer is bypassed. This option lets you do a quick syntax check of
//your source file.
For ifortran also look into these options
-e90
-e95
-stand f90
-stand f95
-noinclude
Upvotes: 3