Creating your own compiler is not a trivial job: it's a lot of careful design and coding, if you want it to be any use in the real world.
There are a lot of books on compiler design:
Google[
^] can help you get started.
Some of the stuff there is "Free" - I don't know if that means "stolen" - and some of it is background material, but there should be enough to get you started thinking anyway.
But don't expect this to be a "one weekend" project: a modern compiler is written by a team of people, and can still take years to produce!