- From: Cameron McCormack <cam@mcc.id.au>
- Date: Sat, 24 Mar 2012 12:10:31 +1100
- To: Marcos Caceres <w3c@marcosc.com>
- CC: Travis Leithead <travis.leithead@microsoft.com>, Marcos Caceres <marcosscaceres@gmail.com>, public-script-coord <public-script-coord@w3.org>
Marcos Caceres:
> The binding part… the syntax part is a different matter. The syntax
> part is much more clear (though it would have been nice if it would
> have been written for a parser), but the only proper parser I've seen
> has issues in that it's machine generated:
>
> https://github.com/darobin/webidl.js
I'm not sure what you mean about being written for a parser. A grammar
is a perfect basis for a parser, no? :) (And you can't get much simpler
than an LL(1) grammar for a language like this, in terms of writing a
parser.)
> I agree that for specification writing, the first half of the spec
> works great. I've used it for the last year on an almost daily basis
> and it's just gotten better and better… but now, implementing the
> bottom part… not so good for me at least.
To be honest, I would find it a bit strange for the spec to have
algorithmic requirements on how to set up the ECMAScript environment. I
mean I guess it could, something like:
To *set up an ECMAScript environment* for a given set of IDL
fragments, run the following algorithm:
1. For each IDL interface:
1. Let intf be a new object.
2. Let proto be a new object.
3. For each IDL operation on the interface:
1. Let F be a Function object that implements the
operation.
2. Let desc be a property descriptor.
3. Set desc.[[Value]] to F.
5. Call [[DefineOwnProperty]] on proto with the
identifier of the IDL operation as the identifier,
desc as the property descriptor, and false for the Throw
argument.
4. For each IDL attribute on the interface:
...
5. Let desc be a property descriptor.
6. Set desc.[[Value]] to proto.
7. Call [[DefineOwnProperty]] on intf with identifier
"prototype", desc as the property descriptor, and false for
the Throw argument.
8. Set desc.[[Value]] to intf.
9. Call [[DefineOwnProperty]] on the global object with
the identifier of the IDL interface as the identifier,
desc as the property descriptor, and false for the Throw
argument.
2. For each IDL exception:
...
but I am not sure if it is worth it.
Received on Saturday, 24 March 2012 01:11:14 UTC