On Fri, 12 Dec 2003, Norman Gray wrote:
> On Fri, 12 Dec 2003, Mark Taylor wrote:
>
> > On Fri, 12 Dec 2003, Giaretta, DL (David) wrote:
> >
> > > Surely it can be done in a few lines of Perl - Al?
> >
> > With both projects, that was my attitude to start with (I'm a bit
> > of a reformed Perl enthusiast), but heavy use of regular expressions
> > turns out to be a pretty bad tool for doing this sort of parsing -
> > they work OK for 95% of the input but get really really nasty
> > when you try to push close to 100%. Could be just my insufficient
>
> What makes it more tractable in this case is that for our purposes you'd
> only have to handle #include, #define and #if (and #ifdef, #else, etc),
> and substitutions on #if lines, so you don't actually have to lex the
> code at all.
>
> So maybe a large few lines of Perl.
If Perl is part of the pre-processing stages, then fine, but I'd say the
trick is to do what you say, keep to a few proscribed directives, try cpp
and if that proves problematic it is an easy job to parse these, even in
FORTRAN itself (upgrade for SST?).
Peter.
|