incubator-flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Left Right <olegsivo...@gmail.com>
Subject Re: [gosh] On the sad tale of BNF and optional semicolons
Date Tue, 21 Feb 2012 18:56:06 GMT
That post on Kirupa - it's me! :) Well, to tell you the truth, I tried some
things, some things I didn't... probably, at times I was lacking motivation
a bit... I honestly tried to look into Waldemar Horwat's code too... that
was basically my biggest hope in this regard. But oh woes and noes... that
man has a brain that can manipulate functions 600+ loc long... my feeble
brain shrugged in fear and refused to proceed :) I mean this:
http://mxr.mozilla.org/mozilla/source/js2/semantics/JSECMA/Parser.lisp and
mind you that's only a portion! and you don't want to look into regular
expressions... on the bright site, it covers almost all of the ECMAScript
syntax.

And, although it's Common Lisp, the code is barely recognizable... it must
be some commercial Lisp dialect, either Allegro or LispWorks, and he used a
lot of things I don't understand, probably particular to those
implementations :(
However, this part for example:
http://mxr.mozilla.org/mozilla/source/js2/semantics/Grammar.lisp is more
understandable, to the level, I eventually can put some bits of it
together. On the other hand it's huge and even though I do understand the
code, it's really difficult to comprehend the program's structure. It was
literary written by one man, probably never even expecting anyone to look
into the sources.

Re' semicolon, try finding ECMAScript standard, it was in PDF somewhere on
their site, but, spending over half an hour I couldn't find it... Though I
remember reading it, and, they do define everything in BNF, so, there's the
definition of a statement, and how the semicolon merges in. However, there
are consequences you might not be aware of yet. For example this:

function f() {
return
1 + 1;
}

is precisely the function that returns undefined! I think you have enough
information to figure out why does it happen ;)

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message