import from RevMode repo. add support for sum{} syntax