Movatterモバイル変換
[0]ホーム
Fortran Parser Question
Tim Robertstimr at probo.com
Sat Apr 14 01:58:01 EDT 2001
"Hassan Aurag" <aurag at geocities.com> wrote:>> I am trying to write a Fortran parser in python.>> What I need is really simple. Given a fortran file, get all variables>with their type and decompose arthmetic operations. Stuff like a = b+c>.... and check their types to see if those ops can be dangerous when>ported on various platforms.Mark is correct; this is a huge problem. You basically need a full-fledgedcompiler. For example, to do a complete job, you're going to have to parsestatement functions and expand them when encountered. IMPLICIT statementsare another interesting twist. Most of the simple parsers you can downloadare for Pascal-type languages. Fortran's "rules" are quite different.Now that we've discouraged you, can you give me a concrete example of thekind of situation you want to detect?> So, I won't need a full fledged compiler, but really something simple. I>am new to regular exps and friends, so if anyone can help with something>simple I can start with, please drop me a note!Fortran is likely to defy analysis with regular expressions. You're goingto need a state-driven lexical analyzer.Have you done a web search for Fortran parsers?--- Tim Roberts,timr at probo.com Providenza & Boekelheide, Inc.
More information about the Python-listmailing list
[8]ページ先頭