Syntax...
Neal Gafter
neal at gafter.com
Sat Nov 21 11:17:41 PST 2009
Are you proposing "fun" be a new keyword?
On Sat, Nov 21, 2009 at 11:11 AM, Vladimir Kirichenko <
vladimir.kirichenko at gmail.com> wrote:
> 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 --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/closures-dev/attachments/20091121/77c6bf0a/attachment.html
More information about the closures-dev
mailing list