Related articles |
---|
Use of punctuation in a language? hsauro@cs.caltech.edu (Herbert) (2003-10-31) |
Re: Use of punctuation in a language? derkgwen@HotPOP.com (Derk Gwen) (2003-11-01) |
Re: Use of punctuation in a language? rosing@peakfive.com (MattR) (2003-11-01) |
Re: Use of punctuation in a language? gah@ugcs.caltech.edu (Glen Herrmannsfeldt) (2003-11-02) |
Re: Use of punctuation in a language? joachim.durchholz@web.de (Joachim Durchholz) (2003-11-08) |
Re: Use of punctuation in a language? bobduff@shell01.TheWorld.com (Robert A Duff) (2003-11-08) |
Re: Use of punctuation in a language? bear@sonic.net (Ray Dillinger) (2003-11-11) |
Re: Use of punctuation in a language? jcownie@etnus.com (James Cownie) (2003-11-11) |
Re: Use of punctuation in a language? landauer@got.net (Doug Landauer) (2003-11-11) |
[5 later articles] |
From: | MattR <rosing@peakfive.com> |
Newsgroups: | comp.compilers |
Date: | 1 Nov 2003 12:01:44 -0500 |
Organization: | Bresnan Online |
References: | 03-10-129 |
Keywords: | syntax, design, comment |
Posted-Date: | 01 Nov 2003 12:01:44 EST |
I built a simple parser that makes some puntuation optional. Sometimes
it's really nice but sometimes you can hang yourself. Be careful with
unary operators that can be confused as binary opeators:
if a<b -3 c=d
could mean
if( a<b) -3; c=d
or
if(a<b-3) c=d
which is exactly what John said.
This example blows up because -3 is a valid statement. If you ran it
through bison with the glr option on it would complain that the grammar
is ambiguous (and I'm being ambiguous about what it is because I think
it won't complain until you run the string to be parsed through). If you
can come up with a non-ambiguous grammar then it would probably be
really nice to use. I can't type special characters without looking at
the keyboard so I'd like it.
Matt
Herbert wrote:
> Does anyone have any comments on the use of punctucation is a
> language, ...
> [ Having used languages in which any string of characters is a valid
> program, I can report that I vastly prefer languages with punctuation
> because they make it harder to write a program that is syntactically
> valid but doesn't mean what I wanted it to. It's a little easier for
> compilers to parse languages with statement separators and explicit
> brackets, but I don't find that anywhere near as compelling as the
> human factors involved. -John]
Return to the
comp.compilers page.
Search the
comp.compilers archives again.