提供對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 。