|Ignore break line sometimes firstname.lastname@example.org (Geovani de Souza) (2012-02-11)|
|Re: Ignore break line sometimes DrDiettrich1@aol.com (Hans-Peter Diettrich) (2012-02-11)|
|Re: Ignore break line sometimes email@example.com (George Neuner) (2012-02-11)|
|Re: Ignore break line sometimes firstname.lastname@example.org (Stefan Monnier) (2012-02-12)|
|Re: Ignore break line sometimes Pidgeot18@verizon.invalid (Joshua Cranmer) (2012-02-12)|
|Re: Ignore break line sometimes email@example.com (Kaz Kylheku) (2012-02-13)|
|Re: Ignore break line sometimes firstname.lastname@example.org (BartC) (2012-02-14)|
|Re: Ignore break line sometimes email@example.com (Gene Wirchenko) (2012-02-19)|
|[3 later articles]|
|From:||Hans-Peter Diettrich <DrDiettrich1@aol.com>|
|Date:||Sat, 11 Feb 2012 17:28:36 +0100|
|Posted-Date:||12 Feb 2012 01:16:14 EST|
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.
Return to the
Search the comp.compilers archives again.