Language Size (was Re: [TLUG]: ECMAScript ("Javascript") Version 4 - FALSE ALARM)

Jeff Dyer jodyer at adobe.com
Wed Oct 31 14:43:17 PDT 2007


I made an attempt to size the ES3 and ES4 grammars by assigning an ES
edition number to each production, sorting and counting both concrete and
abstract forms. Below are the numbers I came up with. This are very rough,
but having implemented parsers for ES3, AS3 and ES4, the ~2x increase in
number of productions feels about right.


                 ES3   ES4
                 ---   ---
Concrete         238   490
  Type Exprs            50
  Classes & Interfaces  23
  Patterns              17

Abstract          33    77


Methodology:

1/sort grammar productions and AST constructors by version
2/count concrete productions for each version
3/sort grammar productions by AST constructor
4/eliminate duplicate constructors
5/sort AST constructors by version
6/count AST constructors for each version

The spreadsheet I used is posted in PDF and XLS formats here:

  http://ecmascript.org/es4/spec/grammar.pdf
  http://ecmascript.org/es4/spec/grammar.xls

Jd  

On 10/31/07 3:46 AM, Maciej Stachowiak wrote:

> 
> 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
> 
> _______________________________________________
> Es4-discuss mailing list
> Es4-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es4-discuss



More information about the Es4-discuss mailing list