Skip to content

Instantly share code, notes, and snippets.

@jasonmay
Created February 6, 2013 19:28
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 jasonmay/9e8d68cfeefe4895df40 to your computer and use it in GitHub Desktop.
Save jasonmay/9e8d68cfeefe4895df40 to your computer and use it in GitHub Desktop.
val num_nodes: PartialFunction[AST, MoeObject] = {
case IntLiteralNode => eval(...)
}
val loop_nodes: PartialFunction[AST, MoeObject] = {
case ForNode => eval(...)
}
val all_nodes = num_nodes orElse loop_nodes orElse etc
val result = all_nodes(ast)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment