Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.42!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!198.186.194.247.MISMATCH!transit3.readnews.com!news-out.readnews.com!news-xxxfer.readnews.com!news.misty.com!news.iecc.com!nerds-end From: Hans-Peter Diettrich Newsgroups: comp.compilers Subject: Re: Ignore break line sometimes Date: Sat, 11 Feb 2012 17:28:36 +0100 Organization: Compilers Central Lines: 24 Sender: johnl@iecc.com Approved: comp.compilers@iecc.com Message-ID: <12-02-011@comp.compilers> References: <12-02-010@comp.compilers> NNTP-Posting-Host: news.iecc.com X-Trace: leila.iecc.com 1329027374 63638 64.57.183.58 (12 Feb 2012 06:16:14 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Sun, 12 Feb 2012 06:16:14 +0000 (UTC) Keywords: parse, design Posted-Date: 12 Feb 2012 01:16:14 EST X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: x330-a1.tempe.blueboxinc.net comp.compilers:451 Geovani de Souza schrieb: > I'm trying write an parser to my compiler, and I'm interessed to > ignore the break line (\n) sometimes. E.g: > > if true then [\n] foo(); [\n] end; [\n] > > So, in the first line, the '\n' after 'then' isn't important, but in > the second "foo();" could replace the need of the semicolon to > conclude the statement, or still, in the 'end'. That's why many (compiled) languages ignore line ends and other whitespace, and require explicit statement termination, e.g. by a semicolon. Interpreters instead often prefer the "one statement per line" approach, with the option to concatenate statements by e.g. a colon. IMO you should make a decision about the meaning of whitespace in general, and of line endings in detail, in your language. Please give an example that would compile differently when linefeeds are removed, and then answer yourself the question whether this really will make sense. DoDi