How to build my own opengl shader compiler?
You don't. At least, not in the way that you mean.
OpenGL does not define a binary or assembly interchange format. OpenGL itself directly compiles GLSL into objects. And even though you can query the binary data, OpenGL does not provide a means to explain what that binary data actually stores. It is implementation-dependent. NVIDIA and AMD will store different info, and that will be different from what Intel stores. It will change for each generation of hardware. And so forth.
You can write a compiler that generates GLSL. But that's about it.
If you're willing to stick with NVIDIA, they have been good about keeping the ARB assembly language up-to-date. But obviously, any such code would be NVIDIA-only.