Sid,
I had to do something like this for work but it was more of a meta language on top of a custom file format for our embedded applications.
Anyway, I would recomend taking a peek at Metsker's book on 'Building Parsers with Java'. After I finished building my tokens my manager told me I had two weeks to wrap it up and ship our product.
Since I work for a pay check I put the parser stuff on the shelf and converted the stuff in and out of XML.
I basically combined special comments with a INI data file to put a dynamic GUI editor on a cryptic protocol configuration file.
Works very well but if you need a smart compiler
you should read the Metsker book.
The book by Andrew W. Appel on modern compiler implementation in Java as a great book as well. The second edition just came out and you might want to give it a look as well.
Hope this helps.
Sincerely,
Ed