Re: Languages that are hard to parse

glen herrmannsfeldt <gah@ugcs.caltech.edu>
18 May 2005 11:49:29 -0400

          From comp.compilers

Related articles
Re: C++ intermediate representation. comeau@panix.com (2005-05-15)
RE: C++ intermediate representation. quinn-j@shaw.ca (Quinn Tyler Jackson) (2005-05-15)
Languages that are hard to parse steve@rh12.co.uk (Steve) (2005-05-16)
Re: Languages that are hard to parse DrDiettrich@compuserve.de (Hans-Peter Diettrich) (2005-05-18)
Re: Languages that are hard to parse gah@ugcs.caltech.edu (glen herrmannsfeldt) (2005-05-18)
Re: Languages that are hard to parse Peter_Flass@Yahoo.com (Peter Flass) (2005-05-19)
Re: Languages that are hard to parse gah@ugcs.caltech.edu (glen herrmannsfeldt) (2005-05-20)
Re: Languages that are hard to parse DrDiettrich@compuserve.de (Hans-Peter Diettrich) (2005-05-20)
Re: Languages that are hard to parse henry@spsystems.net (2005-05-21)
Re: Languages that are hard to parse gah@ugcs.caltech.edu (glen herrmannsfeldt) (2005-05-22)
Re: Languages that are hard to parse Satyam@satyam.com.ar (Satyam) (2005-05-22)
[8 later articles]
| List of all articles for this month |

From: glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups: comp.compilers
Date: 18 May 2005 11:49:29 -0400
Organization: Compilers Central
References: 05-05-119 05-05-125 05-05-147 05-05-155
Keywords: syntax, design
Posted-Date: 18 May 2005 11:49:29 EDT

Hans-Peter Diettrich wrote:
(snip)


> IMO new programming languages are designed for easy parsing, by using
> either a grammar based parser generator, or in handwritten code
> without a (proven) grammar. Derivates of "un-formal" legacy languages,
> like C, fall into their own category (homebrew trouble, dead end ;-)


Not exactly counterexamples, but Fortran and PL/I don't seem to have
been designed to be easy to parse, and as I understand it from people
working with them, they aren't.


PL/I has no reserved words because the designers didn't want people to
have to memorize a big list of words, including those for features
they didn't use. It also makes it easier to add new keywords later.


To me, reserved words are used to make parsing easier, and not to
make programs easier to write.


Still, I believe that designers give a choice between easy to parse
and easy for programmers will chose the latter.


-- glen
[Fortran is actually pretty easy to parse. It's the lexer that's hard since
spaces don't matter (or didn't until recent versions of Fortran.) I gather
that PL/I isn't all that hard to parse once you do some hackery (not unlike
Fortran's) to decide whether a statement is an assignment or starts with a
keyword. It's just bulky. -John]



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.