credmp

Ramblings of a code junkie

The CodeParser project

This OSS project actually stems from around 2001 when I was writing a dead code finder for a project I was working on. The idea/code has been idle ever since. Recently I have found there to be a need for a utility that will report on dead code, provide obfuscation, create reference documentation (not just API documentation) and generate to do lists based on the previous checks.

These requiremens mainly come from my own projects as well as my love for parser / lexer / compiler writing.

The following features are going to be in the first public release:

  • Semantic check: Find dead code in C++ and Java
  • Generate todo lists based on the semantic checks
  • Dump symbol table

After that:

  • Sematic check: Find dead code in Javascript (also parsing HTML for references)
  • Output cross reference documentation
  • Ouput obfuscated code
  • Optionally compress the outputted code (remove comments/whitespace where possible)
  • Emacs library to read dumped symbol table

Besides the above functionality I am also going to write a mode for Emacs that will take the symbol table and provide intellisense code completion for at least Java code. The JDEE based code completion works for me most of the time but I believe this is a better strategy to deal with that problem domain.

I am uncertain when to expect the first public release as I am writing the Symbol Table backend and the language parsers again from scratch. The language chosen to implement this in is C++, mainly to keep in shape with the language since all I write in my day-to-day job is Java nowadays.

Dead Code

The reason for searching for dead code (unused functions, unreachable code fragments, etc) is that it greatly clutters source files that become unreadable if there are large blocks unused/unreachable code.

Unused functions are easily found through a symbol table; the reference counter to the function reference will be 0. Using a common symbol table analogy for all languages allows for easy pin pointing of such code blocks.

Obfuscated code

Although I am not a fan of obfuscated code, I do realize that things like javascript, which have to come over the wire to the end user need to be as small as possible. Obfuscation allows for this in combination with compressing the source code to its bare minimum.

Code compression

Removing comments, unnecessary whitespace and new lines results in the most compressed version of a piece of code that can be pushed over a line. Of course you can add gzip compression to your webserver to further push the limit.

This is mainly usefull for Javascript and such client side language… perhaps also CSS?