Language Size (was Re: [TLUG]: ECMAScript ("Javascript") Version 4 - FALSE ALARM)
Maciej Stachowiak
mjs at apple.com
Wed Oct 31 03:46:35 PDT 2007
On Oct 30, 2007, at 1:23 PM, Maciej Stachowiak wrote:
> By the way, I think the discussions about language size could benefit
> from some quantitative data. I think the following comparisons would
> be interesting:
>
> 1) Size of the ES4 grammar relative to the ES3 grammar (say, by count
> of productions).
Excluding the lexical grammar, the E4X syntax rules (which won't be a
normative requirement) and regular expression syntax, I count:
ECMA-262 3rd Edition: 74 grammar productions
ECMAScript 4th edition draft: 197 grammar productions
That's a more than 2x increase in surface syntax (2.66x to be more
exact). While not completely unreasonable given all the new features,
it seems a little high. Before embarking on this exercise I thought
that 2x would be a reasonable level of core syntax increase. Part of
this may be simply due to better factoring of the grammar, and due to
capturing features like auto semicolon insertion, how if is
disambiguated, noin contexts, etc in more detail.
A lot of the genuinely new stuff just seems to be fallout from the
type system.
I notice some seemingly duplicate features that will perhaps become
more clear on closer reading of the spec. For instance I see all three
of namespace, package and unit productions in the grammar. With my
limited imagination it's hard to think of how those could be three
interestingly different features.
> 2) Size of the ES4 standard library by count of classes, methods and
> properties.
I'll try to look at this soon, too. I think 4-5x would be about the
size that would not raise any red flags for me, given how impoverished
the ES3 standard library is.
Does anyone else have other ideas for objective metrics of language
size?
Regards,
Maciej
More information about the Es4-discuss
mailing list