[Rubygrammar-grammarians] Ruby Grammar Project

Mauricio Fernandez mfp at acm.org
Fri Nov 25 21:36:30 EST 2005


はじめまして、Fernandezと申します。
On Fri, Nov 25, 2005 at 07:44:57PM -0500, MenTaLguY wrote:
[reordered for clarity of exposition]
> I am not sure that 'blah = zort' is parsed differently in these cases,
> however; that subtree may look the same in the AST and simply get
> interpreted differently.

IIRC they result in

>  def foo
    zort = 3 # assign to variable         
      => NODE_LASGN(ID:zort, INT2FIX(3), ...)
>    blah = zort # assign to variable from variable  
      => NODE_LASGN(ID:blah, NODE_LVAR(zort), ...)
>  end


> versus:
> 
>  def foo
>    blah = zort # assign to variable from method result
     => NODE_LASGN(ID:blah, NODE_VCALL(0,ID:zort,0), ...)
>    zort = 3 # assign to variable
     => NODE_LASGN(ID:zort, INT2FIX(3), ...)
>    ...
>  end
> 



以上、よろしくお願いします。
-- 
Mauricio Fernandez


More information about the Rubygrammar-grammarians mailing list