Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED!nerds-end From: Hans-Peter Diettrich Newsgroups: comp.compilers Subject: Re: Programming language and IDE design Date: Thu, 05 Dec 2013 03:35:43 +0100 Organization: Compilers Central Lines: 26 Sender: johnl@iecc.com Approved: comp.compilers@iecc.com Message-ID: <13-12-004@comp.compilers> References: <13-11-016@comp.compilers> <13-11-018@comp.compilers> <13-11-031@comp.compilers> <13-12-003@comp.compilers> NNTP-Posting-Host: news.iecc.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: leila.iecc.com 1386211556 70460 64.57.183.58 (5 Dec 2013 02:45:56 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Thu, 5 Dec 2013 02:45:56 +0000 (UTC) Keywords: Fortran, parse, comment Posted-Date: 04 Dec 2013 21:45:56 EST X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:1059 Martin Ward schrieb: > The difference is even smaller than this: > > DO 10 I = 42.45 > DO 10 I = 42,45 > > The first is an assignment of a floating point value to variable DO10I, > the second is a loop with I as the loop variable. > > Fortran allows spaces in the middle of identifiers, so requiring > spaces around keywords does not help (unless you *also* > disallow spaces within identifiers). > > The fact that the two statements can be distinguished with an LL(k) > parser does not necessarily mean that the language is easy to read. How would a LL grammar look like, when the lexer returns multiple tokens for an identifier, here "DO","10" and "I"? With a traditional lexer I'd suspect that such a language is *context sensitive*, with something else for "LL(k)". DoDi [I suppose the prepass to tell whether it's an assignment is LL(1). You definitely need to preprocess the statement to tell whether it's an assignment or something else. After that, the parsing is very easy. -John]