[Ironruby-core] Code Review: RubyAST

Tomas Matousek Tomas.Matousek at microsoft.com
Fri Aug 15 12:49:41 EDT 2008

The nodes are not implemented at all.


-----Original Message-----
From: Oleg Tkachenko
Sent: Friday, August 15, 2008 9:46 AM
To: Tomas Matousek; IronRuby External Code Reviewers
Cc: ironruby-core at rubyforge.org
Subject: RE: Code Review: RubyAST

Finalizer.cs and Initializer.cs still contain empty //TODO: comments. It's not obvious to me from the context what should be TODO.
Otherwise looks great.


-----Original Message-----
From: Tomas Matousek
Sent: Friday, August 15, 2008 9:22 AM
To: IronRuby External Code Reviewers
Cc: ironruby-core at rubyforge.org
Subject: Code Review: RubyAST

tfpt review "/shelveset:RubyAST;REDMOND\tomat"

Merges Statement with Expression in AST. Gets rid of ExpressionStatement to make ASTs smaller.
Any AST expression can be now emitted as statement (i.e. we don't need its value) by Transform method and any statement can be emitted as expression by TransformRead method.

The grammar considers a construct a syntactic statement if the grammar doesn't allow it to be read in an assignment rhs or pass it as an argument to a method call.
For example,

a = return 1
foo(return 1)
foo(1 if false)

are not valid Ruby statements, therefore 'return <expr>' and '<stmt> if <expr>' are syntactic statements.

If a statement is used in begin ... end or (...) block as the last statement its value becomes the value of the block. This way a value of some statements can be retrieved (e.g. alias foo bar, undef x, <stmt> if <expr>, <stmt> while <expr>). Most of such statements have nil value, some of them however might evaluate to a non-nil value (e.g. <stmt> if <expr>).


More information about the Ironruby-core mailing list