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) |
Re: Languages that are hard to parse DrDiettrich@compuserve.de (Hans-Peter Diettrich) (2005-05-22) |
[7 later articles] |
From: | Peter Flass <Peter_Flass@Yahoo.com> |
Newsgroups: | comp.compilers |
Date: | 19 May 2005 21:42:45 -0400 |
Organization: | Road Runner |
References: | 05-05-119 05-05-125 05-05-147 05-05-155 05-05-166 |
Keywords: | parse, design |
Posted-Date: | 19 May 2005 21:42:45 EDT |
glen herrmannsfeldt wrote:
> 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.
Not really as much of a problem as it's said to be. Naturally a
top-down or recursive-descent parser is impossible, but otherwise it's
quite clean.
....
> [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]
You just need to do look-ahead. If I were starting from scratch I'd
just pull in the whole program and then parse. As it is I did a bit
more work because some of my code does a partial parse of an expression
as tokens are read, when it would be simpler to just wait until a whole
statement has been read before parsing.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.