Re: Ignore break line sometimes

Stefan Monnier <monnier@iro.umontreal.ca>
Sun, 12 Feb 2012 10:48:20 -0500

          From comp.compilers

Related articles
Ignore break line sometimes geovanisouza92@gmail.com (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 gneuner2@comcast.net (George Neuner) (2012-02-11)
Re: Ignore break line sometimes monnier@iro.umontreal.ca (Stefan Monnier) (2012-02-12)
Re: Ignore break line sometimes Pidgeot18@verizon.invalid (Joshua Cranmer) (2012-02-12)
Re: Ignore break line sometimes kaz@kylheku.com (Kaz Kylheku) (2012-02-13)
Re: Ignore break line sometimes bc@freeuk.com (BartC) (2012-02-14)
Re: Ignore break line sometimes genew@ocis.net (Gene Wirchenko) (2012-02-19)
Re: Ignore break line sometimes gah@ugcs.caltech.edu (glen herrmannsfeldt) (2012-02-20)
Re: Ignore break line sometimes arnold@skeeve.com (2012-02-23)
[1 later articles]
| List of all articles for this month |

From: Stefan Monnier <monnier@iro.umontreal.ca>
Newsgroups: comp.compilers
Date: Sun, 12 Feb 2012 10:48:20 -0500
Organization: Compilers Central
References: 12-02-010
Keywords: parse
Posted-Date: 12 Feb 2012 16:14:45 EST

> 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'.


A simple approach is to treat every newline as a semi-colon, and then to
adapt your grammar so as to accept (and ignore) extra semi-colons.
I.e. accept "if true then; foo(); ; end; ;"




                Stefan


Post a followup to this message

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