In reply to:
http://www.mail-archive.com/[email protected]/msg00001.html
I just got the following working fine:
Taking:
{:multiply=>{:left=>{:int=>"2"@0}, :right=>{:sum=>{:left=>{:int=>"2"@4},
:right=>{:int=>"1"@8}}}}}
And re-associating it as:
{:sum=>{:left=>{:multiply=>{:left=>{:int=>"2"@0}, :right=>{:int=>"2"@4}}},
:right=>{:int=>"1"@8}}}
I'd like to make this generic, such that you can basically flag rules as left
or right associative, inside the parser (left(:rule) vs. right(:rule)) and have
#parse pass its result through a Transformation that is based on which rules
have been marked as having different associativity.
I'll post back if I come up with anything.