intial version. works for simple examples.

Review and comment please. If OK, comment :shipit: .
@changyangliu