don't memoize non-terminals pointing to leaves