views:

25

answers:

1

Hello all,

I'm going to create a javadoc look-a-like for the language I'm mainly using, but I was wondering - is it worth to use a parser generator for this? The main idea to use a parser generator was because I could use templates for the HTML code which could be exported then. Also I could also use PDF templates if I need it.

Thanks,

William v. Doorn

A: 

If all you are going to do is extract the "Javadoc" comments, you don't need a full parser; after all, you only need to recognize the comments and regexps will likely do fine.

If you want to extract information from the code and use it augment the javadoc comments, you'll need not only a parser but also name and type resolution.

You can see the results of combining parsing, name/type resolution, and Javadoc comment extraction in the Java Source Code Browser, which produces Javadoc results along with fully hyperlinked source code cross-referenced into the Javadocs.

The machinery which produced this is a generalization of something like ANTLR. But there was little need of using code templates to produce the HTML itself; all the hard work is in parsing and fact collection across the symbol tables.

Ira Baxter
Well, I think I'm only going to read the comments - so I'll guess I just go with some simple regex parsing. Thank you.
wvd