refactor(kernel): serializer and deserializer

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
test(tests/kernel): adjust expr tests

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>