Reia PEG Issue #3: Associativity of Ranges (..)

2 views
Skip to first unread message

Graeme Defty

unread,
Aug 18, 2010, 8:55:26 PM8/18/10
to re...@googlegroups.com
This is one of a series of questions which have arisen from work in developing a PEG for Reia:

-- Symbols involved:
..

-- Issue:
The current syntax rules define ranges to be right-associative, but they should be non-associative.

-- Rationale:
Both left and right operands to a range operator (in Ruby at least) need to support the <=> operator and the succ method, and ranges do not.

-- My Suggestion:
Make the .. operator non-associative.

Tony Arcieri

unread,
Aug 19, 2010, 12:20:51 AM8/19/10
to re...@googlegroups.com
A quick attempt to make ranges non-associative introduces a shift/reduce conflict. Unfortunately the feedback yecc provides isn't terribly helpful at troubleshooting shift/reduce conflicts, so I'll have to look into this more.

Alternatively, you can fix it in your PEG, and I'll leave it as-is in the yecc grammar :)

--
You received this message because you are subscribed to the Google Groups "Reia" group.
To post to this group, send email to re...@googlegroups.com.
To unsubscribe from this group, send email to reia+uns...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/reia?hl=en.



--
Tony Arcieri
Medioh! A Kudelski Brand

graeme defty

unread,
Aug 19, 2010, 1:31:22 AM8/19/10
to Reia
Tony,

That works for me. (As long as we keep a list of these issues so that
if-and-when you ever do adopt the PEG there is a clear reference point
for what will break.)

g
_______________________________
On Aug 19, 11:20 am, Tony Arcieri <tony.arci...@medioh.com> wrote:
> A quick attempt to make ranges non-associative introduces a shift/reduce
> conflict. Unfortunately the feedback yecc provides isn't terribly helpful at
> troubleshooting shift/reduce conflicts, so I'll have to look into this more.
>
> Alternatively, you can fix it in your PEG, and I'll leave it as-is in the
> yecc grammar :)
>
> On Wed, Aug 18, 2010 at 6:55 PM, Graeme Defty <graeme.de...@gmail.com>wrote:
>
>
>
> > This is one of a series of questions which have arisen from work in
> > developing a PEG for Reia:
>
> > -- Symbols involved:
> > ..
>
> > -- Issue:
> > The current syntax rules define ranges to be right-associative, but they
> > should be non-associative.
>
> > -- Rationale:
> > Both left and right operands to a range operator (in Ruby at least) need to
> > support the <=> operator and the succ method, and ranges do not.
>
> > -- My Suggestion:
> > Make the .. operator non-associative.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Reia" group.
> > To post to this group, send email to re...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > reia+uns...@googlegroups.com <reia%2Bunsu...@googlegroups.com>.

Tony Arcieri

unread,
Aug 19, 2010, 1:55:01 AM8/19/10
to re...@googlegroups.com
Upon further examination I'm confused how ranges could be non-associative.

How should a case like 1..2..3 be handled?

To unsubscribe from this group, send email to reia+uns...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/reia?hl=en.

Tony Arcieri

unread,
Aug 19, 2010, 1:59:19 AM8/19/10
to re...@googlegroups.com
Whoops, a bit of confusion on my part! Ranges are now non-associative.
Reply all
Reply to author
Forward
0 new messages