Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #2327

Re: Regular expressions in lexing and parsing Fortran

From steve kargl <sgk@troutmask.apl.washington.edu>
Newsgroups comp.compilers
Subject Re: Regular expressions in lexing and parsing Fortran
Date 2019-05-22 04:12 +0000
Organization A noiseless patient Spider
Message-ID <19-05-096@comp.compilers> (permalink)
References <19-05-092@comp.compilers> <19-05-095@comp.compilers>

Show all headers | View raw


Hans-Peter Diettrich wrote:

> OTOH I wonder how a formal (regex?) FORTRAN lexer grammar could look like?
>
> [I've written Fortran 77 parsers.  It was quite context sensitive, particularly
> deciding whether a statement was an assignment or something else. e.g.
>
>  FORMAT(I4) = 42
>  DO 10 I = 1.23   (oops)
>
> Modern Fortran no longer ignores spaces which makes lexing a lot easier. -John]

Fortran supports two forms.  Fixed source form is what might be called
the legacy form, where spaces are ignored.  Spaces are significant for
free source form.  See Section 6.3 of the Fortran 2018 standard (ie,
N2146.pdf).

So, yes, a Fortran compiler has two lexer/parsers.

--
steve

Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Regular expressions in lexing and parsing Ed Davis <ed_davis2@yahoo.com.dmarc.email> - 2019-05-17 13:18 +0000
  Regular expressions in lexing and parsing Ben Hanson <jamin.hanson@googlemail.com> - 2019-05-18 13:24 +0100
  Re: Regular expressions in lexing and parsing Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2019-05-21 07:14 +0200
    Re: Regular expressions in lexing and parsing Fortran steve kargl <sgk@troutmask.apl.washington.edu> - 2019-05-22 04:12 +0000
    Re: Regular expressions in lexing and parsing "Ev. Drikos" <drikosev@gmail.com> - 2019-05-23 18:42 +0300

csiph-web