Syntax...

Neal Gafter neal at gafter.com
Sat Nov 21 11:03:00 PST 2009


On Sat, Nov 21, 2009 at 10:19 AM, Vladimir Kirichenko <
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/ }
>

This is all very confusing.  From /Function/ I derive

using
    /Function/:
               fun /TypeSpec/ /Assignment/?

we get

fun /TypeSpec/ /Assignment/

using
       /TypeSpec/:
               /Type/? /ParamsSpec/? /ThrowsSpec/?

and taking all the optional parts to be empty, we get

fun /Assignment/

Then using
       /Assignment/:
               = /AnonymousLambda/

this results in

fun = /AnonymousLambda/

Then using
       /AnonymousLambda/:
               fun /TypeSpec/ => /Body/

this becomes
fun = fun /TypeSpec/ => /Body/

Again, taking /TypeSpec/ to be empty, as before, and using
       /Body/:
               /Expression/ | { /StatementList/ }

we finally get

fun = 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?

Cheers,
Neal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/closures-dev/attachments/20091121/4fabdf7a/attachment.html 


More information about the closures-dev mailing list