I remember wanting to write a compiler a few years ago. I didn't manage it, but after getting hold of
this tutorial I did write a small interpreter and a calculator program which could read in a maths function, d/dx it and find a root.
That tutorial covers recursive descent parsing which is the easiest to write by hand (i.e. without Flex and Bison or Lexx and Yacc) and it even outputs assembly code, but it's assembly for some Motorola chip so don't expect it to work with an x86 assembler.