Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: comp.lang.javascript Subject: Re: x === x Date: Thu, 01 Jun 2017 21:54:08 +0100 Organization: A noiseless patient Spider Lines: 74 Message-ID: <8737bjtonj.fsf@bsb.me.uk> References: <874lw231ui.fsf@bsb.me.uk> <2872662.aeNJFYEL58@PointedEars.de> <87inkh28sf.fsf@bsb.me.uk> <19437984.EfDdHjke4D@PointedEars.de> <87efv4zr3k.fsf@bsb.me.uk> <2276977.Lt9SDvczpP@PointedEars.de> <87k24wy1pw.fsf@bsb.me.uk> <1496e413-37d6-4ff2-ba03-09d853438559@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: mx02.eternal-september.org; posting-host="b8cfcc8b3b6248419b3e2a0831823cf6"; logging-data="15906"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18xDgEBx0SE/66ziASL05irVhNyGBwefrM=" Cancel-Lock: sha1:LbgDymNW4nHzXNZ+q+WPgxgtd+s= sha1:Zqbf35W4Ehtf/9jSjo+7AO8TnVU= X-BSB-Auth: 1.68f72c49a6980255510f.20170601215408BST.8737bjtonj.fsf@bsb.me.uk Xref: csiph.com comp.lang.javascript:33485 ram@zedat.fu-berlin.de (Stefan Ram) writes: > John G Harris writes: >>It seems I have to say it again : >>Some ignorant people think that if it isn't in BNF then it isn't a >>syntax rule. They are wrong. > > Depending on the definition of »syntax rule«, you might > be right with this. Most languages have two grammars -- a simple grammar for tokens (it is often "regular" in the technical sense) and a more complex grammar of tokens that describes the syntax of the larger units -- programs in effect. ECMAScript is one of these. The semicolon insertion rules operate at the lexical level. The tokens seen by the parser will, logically, already include any added semicolons. Finally, ECMAscript also has lookahead conditions that direct the parse. These are a convenience (just like its labeled EBNF) that means the EBNF rules can be much shorter. There may also be rules that are written out only in English. C and C++ have these, and ECMAScript /might/ have -- I've not checked the whole document. All of these contribute to "the syntax". >>That's why the behaviour of newline after 'return' isn't an ambiguity. > > But the behavior clearly is part of the semantics > (not of the syntax) of a programming language. > > (Also, I am not aware of a definition of »ambiguity« > in this thread. When does one say that a behavior is > an ambiguity? [intended as a rhetorical question - > so it would not be considered impolite by me if you > do not respond to it.]) No, that is a problem. I'd like to see examples because that would help clarify what people mean, both by "the syntax" and "ambiguous". Obviously no serious programming language has an ambiguous syntax when all the parts above are considered. None the less it's not unreasonable to say that C's grammar (note the term) is ambiguous, because x(y); could be a function call or declaration if f is a typedef name. The EBNF grammar is not enough to resolve the ambiguity. > By your spelling of »behavior« you seem to indicate > that you might come from England. I used to believe > that englishmen always try to be extraordinarily > courteous. In this case the following hint might help: > > The paragraph > > »Some ignorant people think that if it isn't in > BNF then it isn't a syntax rule. They are wrong.« > > can be reworded (removing "ignorant people") as > > »Not all syntax rules are expressed in BNF.« True. I suspect John G Harris is simply fed up with Julio Di Egidio habit of spinning off into abuse at the first sign of disagreement. I try to remain civil, but that in itself probably comes over as rude since it can appear to be passive-aggressive. -- Ben.