groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Дионисьев Павел <xseagu...@gmail.com>
Subject Re: Groovy grammar ambiguity / question
Date Tue, 15 Mar 2016 16:45:01 GMT
Dear Jesper,

As far as I remember, command expressions are allowed as statements only.
There will be lots of ambiguities otherwise.

Also, there are known issues in grammar, listed in original repository
<https://github.com/xSeagullx/antlrv4_groovy_grammar/issues>. You might
want to have a look and incorporate them in your issue tracker.

And thank you for working on this project!

Pavel.
​

On 15 March 2016 at 17:22, Jesper Steen Møller <jesper@selskabet.org> wrote:

> Hi List
>
> I’ve yet to fully understand the rules behind the parenthesis-less method
> invocation syntax. Basically, it seems that while parenthesis-less method
> invocation (“command style”) can sometimes be used as an expression, it’s
> not universally so.
>
> I’d like to understand whether this is a merely an oversight or due to the
> current state of affairs in the parser, or intentional.
>
> Consider:
> int a = b c
> This is legal and equivalent to
> int a = b(c)
> similarly:
> a = b c
> Works fine, too, letting “b c” be a valid expression.
> However, the following:
> if (b c) {
> // Stuff
> }
> Gives an error:
> expecting ‘)’, found ‘c’ at line: 1, column: 11
>
> So, is the “command” syntax a special pseudo-expression, and if so, where
> is it allowed? Only by itself (“statement”), and as the RHS og assignments
> and initializers?
>
> I’d like to know this as it could get real nasty, depending on the answer,
> since allowing it everywhere will introduce some ambiguities, which will
> require some tweaks to keep the “non-left-recursion refactored” grammar we
> have now.
>
> Also, great news:
> Daniel Sun has started contributing fixes, submitting PR’s against the
> fork at https://github.com/jespersm/groovy/tree/antlr4 - he’s quite
> productive, thanks!
>
> For coordination, I’ve started tracking some of the known “things to do”
> at https://github.com/jespersm/groovy/issues
>
> -Jesper
>
>


-- 
С уважением, Дионисьев П.А.

Mime
View raw message