Bulk spell checking for C code

461 Views Asked by At

I have a large source code package in C and I would like to spell check all string literals and comments. After adding exceptions to a file, I would like to perform the same procedure on each release, to see if there are any spelling errors inserted.

I have checked with ispell, hunspell and aspell but, to my disappointment and surprise, although they do seem to understand HTML, Tex and a few other languages they do not have a C feature. The closest I found was a "ccpp" filter mentioned for aspell, but when I "aspell dump filters" the ccpp filter is not listed.

Any ideas?

1

There are 1 best solutions below

0
Jean-François Fabre On

You have to write a lexer first to extract string constants and comments to a text file with the associated line & column of the source file. (ply can be useful or lex/yacc but needs some coding).

Then use whatever spell checker you like, then parse the report, and trace back to the original C file location.

Or connect directly the spell checker to your lexer.