|Complex Constants in Fortran firstname.lastname@example.org (1993-01-02)|
|Re: Complex Constants in Fortran email@example.com (1993-01-04)|
|Re: Complex Constants in Fortran firstname.lastname@example.org (1993-01-04)|
|From:||email@example.com (Lou Glassy)|
|Date:||Sat, 2 Jan 1993 00:31:45 GMT|
|Keywords:||Fortran, parse, question, comment|
A question for those of you who have written Fortran compilers..
Does the scanner resolve complex constants in Fortran, or does
Here's where the question arises. Say you have a hunk of code like
X = FU ( 1.0, 3.4 ) ! has to be a function call, but
! the scanner doesn't know that...
I'd guess the scanner would return a stream of tokens like
and now comes the part I'm curious about. Should the scanner return
or should the scanner return
If I go the first route, then a COMPLEX_CONSTANT must be resolved (or
'constructed') by the parser -- which is no great disaster. Conceptually,
though, it seems that constants of any type should be resolvable by the
scanner. Is there not enough contextual information available to the
scanner to do this?
Thanks in advance --
Lou Glassy (firstname.lastname@example.org)
[In INfort I constructed complex constants in the parser because it was
easier to do that way, and while I was at it I allowed (exp,exp) as a general
complex expression constructor. It wouldn't have been very hard to do in
the scanner; there are so many lexical hacks in parsing Fortran already that
telling whether a complex constant is allowed is easy. In the case above,
the scanner had better return the list of primitive tokens unless you want to
add a lot of extra glop to the parser to take complex constants apart in the
places where they turn out to be pairs of procedure arguments. -John]
Return to the
Search the comp.compilers archives again.