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. : 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! I think you may be approaching this problem from the wrong direction. Rather than building your own half-baked compiler, consider using an existing Fortran compiler that is really, really picky and is often used for writing portable software. The Gnu folks write a lot of portable software and I know from experience that their gcc compiler is--with the right options--pretty good at catching non-portable constructs. I don't have much experience with their Fortran compiler (g77) but I'd certainly check whether it's also good at catching non-portable constructs. If it works, it's certainly going to be much easier than writing your own. Another option: go to www.netlib.org, which is a site for numerical analysis software, written mostly in Fortran, and browse around for Fortran programming tools. It wouldn't surprise me if something like what you want already exists. Look also at f2c, which is a Fortran-to-C converter; even if it doesn't provide good diagnostics, it contains a Fortran parser already written which you can try adapting. Paul Hughett
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4