help-flex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fortran


From: Comp.compilers
Subject: Re: Fortran
Date: 27 Feb 2003 13:34:53 -0500

> >Lexing Fortran isn't very hard once you realize that you have to make a
> >prepass over each statement ...

> It strikes me that one might attempt to tweak Flex by first pick down the
> statement prepass, and when one knows it is an assignment or something
> else, one sets an appropriate start condition and then puts the scanned
> characters back into the stream. A similar approach might be used to figure
> out the token boundaries, scanning as long is necessary, letting a special
> function determine the first token boundary, and then putting back the
> remaining characters.

In the Fortran lexers I've written, there's a prepass over the whole
statement to deal with the column and continuation rules and to see if
it's an assignment or statement function, followed by fairly conventional
lexing with a whole lot of context kludges.  You could certainly create a
large set of flex start conditions to handle the kludges, but the lexer
you ended up with would be so awful that I don't see the point.

Regards,
John Levine, comp.compilers moderator,
address@hidden, http://compilers.iecc.com





reply via email to

[Prev in Thread] Current Thread [Next in Thread]