提供对Fortran代码的Lexing/解析和早期静态分析。涵盖了以下Fortran标准:
解析是可配置的,您可以选择目标的Fortran标准,包括非标准Fortran 77的特殊扩展模式。
包括数据流和基本块分析,重量和类型分析。
该软件包主要导出Haskell库,但也构建可执行的可执行文件,可用于测试和调试。例如,请参见Camfort项目,该项目将Fortran-SRC用作前端。
我们为Windows,Mac和Linux提供了预制的二进制文件。
将fortran-src添加为您的Haskell项目的依赖性。我们正在攻击,也在堆栈中。
您也可以在命令行中调用fortran-src 。
对于输出图形的功能,预期的用法是将其输送到命令dot -Tpdf中,然后将其重定向到PDF文件中。 dot命令是GraphViz项目的一部分,请参阅其手册,以获取用于可视化目的的许多其他选项。
Usage: fortran-src [OPTION...] <file>
--version show fortran-src version
-v VERSION, -F VERSION --fortranVersion=VERSION Fortran version to use, format: Fortran[66/77/77Legacy/77Extended/90]
-a ACTION --action=ACTION choose the action, possible values: lex|parse
-t --typecheck parse and run typechecker
-R --rename parse and rename variables
-B --bblocks analyse basic blocks
-S --supergraph analyse super graph of basic blocks
-r --reprint Parse and output using pretty printer
--split-long when using pretty printer, split long lines via continuations
--dot output graphs in GraphViz DOT format
--dump-mod-file dump the information contained within mod files
-C[CPP-OPTS] --cpp[=CPP-OPTS] run the C Pre Processor on the Fortran files first
-I DIR --include-dir=DIR directory to search for precompiled 'mod files'
-c --summarise, --compile-mod build an .fsmod file from the input
-o FILE --output-file=FILE name of output file (e.g. name of generated fsmod file)
--make-mods, --make determine dependency order of modules and automatically build .fsmod files
--show-make-graph dump a graph showing the build structure of modules
--show-make-list dump a list of files in build dependency order (topological sort from the dependency graph)
--show-block-numbers[=LINE-NUM] Show the corresponding AST-block identifier number next to every line of code.
--show-flows-to=AST-BLOCK-ID dump a graph showing flows-to information from the given AST-block ID; prefix with 's' for supergraph
--show-flows-from=AST-BLOCK-ID dump a graph showing flows-from information from the given AST-block ID; prefix with 's' for supergraph
如果您不传递--fortranVersion标志,则该版本将从文件名中猜测:
*.f结尾的文件用扩展的Fortran 77语法解析。*.f90结尾的文件用Fortran 90语法解析(分别为*.f2003 / *.f03 , *.f2008 / *.f08 )。*.f文件。 您将需要GMP Library Plus标头文件:在许多平台上,这将通过软件包libgmp-dev 。
haskell库依赖项在package.yaml中列出。 Fortran-SRC支持堆栈或Cabal的建筑物。
Fortran-SRC支持GHC 9.0至GHC 9.4 。我们定期测试至少受支持的GHC。在/更新之前发行的问题可能有问题。我们欢迎修复程序,这将使我们支持更广泛的编译器。
您可能至少需要3个机器人的内存才能构建Fortran-SRC。
对于安装GHC和构建工具,我们强烈建议GHCUP。
当使用最新建议时,这意味着GHCUP标记使用recommended的最新版本。这有时会落后于latest标记的版本。安装了GHCUP,运行ghcup list以更好地理解。
以下是任何提供相关工具的操作系统的通用指南。如果遇到麻烦,请考虑在.github/workflows中检查CI工作流文件。
我们支持最新推荐的Stack(截至2021-09-17,Stack 2.7)。通常,任何堆栈2.x都应起作用。 (堆栈1.x可能与次要交替使用 - 您可能必须手动下载解析器。)
stack build
对于交互式外壳:
stack build
stack ghci
请注意,在运行stack build之前运行stack ghci无法正常工作,因为stack ghci没有运行诸如Alex和Happy之类的构建工具。因此,将不会构建解析器模块,并且在构建其他模块后您会收到错误。您可以作弊并运行stack build直到看到Building library for [...] (=预处理完成),然后按<Ctrl-C>按照往常而停止构建并运行stack ghci 。
我们支持最新推荐的Cabal(截至2021-09-17,Cabal 3.4)
cabal build
单位测试存储在test中。使用stack test或cabal test运行。
fortran-src可以在骇客和堆栈中获得,因此对于Cabal或堆栈项目,您只需要在项目依赖项中添加fortran-src即可。
如果您在堆栈设置中需要特定版本的fortran-src,则可以使用extra-deps将hackage参考填充到stack.yaml中,例如:
resolver : ...
...
extra-deps :
- ...
- fortran-src-$VERSION如果您已经正确配置了Cabal,则应该可以从hackage中安装Fortran-SRC:
cabal install fortran-src
我们为某些平台提供预构建的二进制文件:请参阅“版本”选项卡。
否则,您可以从源构建并使用便利命令,例如cabal run , stack run 。有关详细信息,请参见#Building。
我们欢迎错误报告,修复和功能建议。在GitHub存储库上添加问题或创建拉动请求。
您也许可以在Libera.Chat IRC网络上找到维护者。入住#fortran-src和#camfort。否则,您可以与Camfort团队页面上的团队之一联系 - 或创建一个描述您问题的问题,我们会看看。
请参阅CAMFORT/CAMFORT中的doc/maintainers.md 。