Parsing Fortran

Joe Krahn krahn@niehs.nih.gov
Fri Jul 14 21:07:00 GMT 2006


Parsing Fortran is difficult. A hand-made parser, like the one developed 
by Andy V. can be fairly ugly.

In thinking about the problem, I came up with a decent scheme for 
getting most of the work done with a YACC style parser. The general idea 
is to split the parsing into two layers. The first layer tokenizes data, 
the second layer does the actual interpreting. I have it partly 
implemented in Perl using Parse::Yapp. My idea is to make a small and 
simple but accurate Fortran parser, that can be used as a base tool for 
Fortran source code processing, for re-formatting, 'lint'-ing, etc.

With the GFortran team having dealt with parsing, how effective does 
this parsing scheme sound? Are others here interested in a Perl-based 
code manipulation tool?

Joe Krahn



More information about the Fortran mailing list