Syntax...
Vladimir Kirichenko
vladimir.kirichenko at gmail.com
Sat Nov 21 11:11:14 PST 2009
Neal Gafter wrote:
> On Sat, Nov 21, 2009 at 10:19 AM, Vladimir Kirichenko
> <vladimir.kirichenko at gmail.com <mailto:vladimir.kirichenko at gmail.com>>
> wrote:
>
> /AnonymousLambda/:
> fun /TypeSpec/ => /Body/
> /TypeSpec/:
> /Type/? /ParamsSpec/? /ThrowsSpec/?
> /ParamsSpec/:
> ( /Param/+ )
> /Param/:
> /Type/ ID
> /ThrowsSpec/:
> throws /ExceptionType/+
> /Body/:
> /Expression/ | { /StatementList/ }
>
> The return type, params and throws declared optional to reduce
> unnecessary "empty" constructs.
>
> ...
>
> EBNF:
>
> /Function/:
> fun /TypeSpec/ /Assignment/?
> /Assignment/:
> = /AnonymousLambda/
> /TypeSpec/:
> /Type/? ID /ParamsSpec/? /ThrowsSpec/?
> /ParamsSpec/:
> ( /Type/+ )
> /ThrowsSpec/:
> throws /ExceptionType/+
>
> ...
>
> EBNF:
>
> /Function/:
> fun /TypeSpec/ => /Body/
> /TypeSpec/:
> /Type/? ID /ParamsSpec/? /ThrowsSpec/?
> /ParamsSpec/:
> ( /Param/+ )
> /Param/:
> /Type/ ID
> /ThrowsSpec/:
> throws /ExceptionType/+
> /Body/:
> /Expression/ | { /StatementList/ }
>
Sorry for confusion - it's 3 differened EBNFs - haven't synced them.
> This is all very confusing. From /Function/ I derive
>
> using
> /Function/:
> fun /TypeSpec/ /Assignment/?
>
> we get
>
> fun /TypeSpec/ /Assignment/
>
> using
> /TypeSpec/:
> /Type/? /ParamsSpec/? /ThrowsSpec/?
It's wrong TypeSpec. In /Function/ it's slightly different:
/TypeSpec/:
/Type/? ID /ParamsSpec/? /ThrowsSpec/?
> and taking all the optional parts to be empty, we get
>
> fun /Assignment/
fun ID /Assignment/
> Then using
> /Assignment/:
> = /AnonymousLambda/
>
> this results in
>
> fun = /AnonymousLambda/
fun ID = /AnonymousLambda/
> Then using
> /AnonymousLambda/:
> fun /TypeSpec/ => /Body/
>
> this becomes
> fun = fun /TypeSpec/ => /Body/
fun ID = fun /TypeSpec/ => /Body/
> Again, taking /TypeSpec/ to be empty, as before, and using
> /Body/:
> /Expression/ | { /StatementList/ }
>
> we finally get
>
> fun = fun => 3
fun ID = fun => 3
> I just have no idea what it is all supposed to mean. Is this a
> declaration? A statement? An expression? Is it supposed to define
> something?
so it's a declaration of identifier ID of declared type "fun void ()"
and type mismatch compiler error "expected: void but found: int".
--
Best Regards,
Vladimir Kirichenko
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 259 bytes
Desc: OpenPGP digital signature
Url : http://mail.openjdk.java.net/pipermail/closures-dev/attachments/20091121/06d96313/attachment-0001.bin
More information about the closures-dev
mailing list