Skip to content

Instantly share code, notes, and snippets.

@takeshik
Created September 13, 2012 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takeshik/3716661 to your computer and use it in GitHub Desktop.
Save takeshik/3716661 to your computer and use it in GitHub Desktop.
public IEnumerable<Expression> ReduceYield(SymbolTable symbols, Type expectedType)
{
Expression expression = this;
while (true)
{
Expression result;
if (expression is YacqExpression)
{
result = ((YacqExpression) expression).ReduceOnce(symbols, expectedType);
}
else
{
result = expression.Reduce();
}
yield return result;
if (result == expression)
{
yield break;
}
else
{
expression = result;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment