incubator-flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Arno" <>
Subject RE: [gosh] On the sad tale of BNF and optional semicolons
Date Wed, 22 Feb 2012 12:45:50 GMT
Martin & Oleg(?),

Thank you for the links. Unfortunately, they just confirm my point I think
unless, I've got myself completely confused. For example, taking Martin's
first link (, the
grammar is full of things like:

	'continue' /* [ no line terminator here ] */ (identifier)? SEMI

In other words, the grammar is saying one thing (that continue, followed by
a new line, then a semicolon is valid and that continue without the
semicolon is not valid) whereas the true language rules are different (as
partially expressed by the /* [ no line terminator here ] */ comment.)

Likewise, Martin found a grammar that tried to deal with it by just marking
semicolons as optional ( The
problem with this grammar is that it effectively makes

var x:int y = 9 return 1 + 1;

a legal line of code. Not only is it unpleasant to read, but it would cause
a parser conflict as the parser would not know (and so would have to guess)

return 1 + 1

meant "return 1 + 1"; or "return; 1 + 1;". The EcmaScript specs seem bad
enough, without us adding to the WTF? count :)

Everything I've read points to the same thing: EcmaScript-style languages
cannot be expressed as BNF. I suspect that the reason why Adobe are talking
about the changes to language in the Falcon compiler breaking some existing
AS3 projects is because they have had to modify the language to make it
definable in something like BNF.


-----Original Message-----
From: Martin Heidegger [] 
Sent: 21 February 2012 17:39
Subject: Re: [gosh] On the sad tale of BNF and optional semicolons

Hello David,

I don't have the time to read into it, but afaik JavaScript has the same
"problem", maybe [1] can help you find a solution for your problem. I am
finding it hard to believe this is a unsolved problem in BNF.



View raw message