PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, no array or string given in /am/paramount/vol/ecs/sites/whiley/wp-includes/class-wp-hook.php on line 298


  • No categories

A Source File with 72KLOC!?

Yesterday, I was looking at the stats on Ohloh for the Whiley project and noticed that my total line count for the project had increased from around 65KLOCto 143KLOC over a very short amount of time:

Confused, I was pondering this for a while.  Then it struck me: I’d checked in a single file with 72KLOC! How could I forget that? That explains the sudden jump and, I’m sure, will mess with any metrics for the project.  And, you guessed it, that file has no commenting whatsoever!

Anyhow, the question remains: how could I possibly have such a huge file? Well, it’s a fair question that deserves an answer.  The good news is that I didn’t write that file — it was automatically generated for me.  Which explains the lack of comments, and general ugliness of the file.  The file implements a complete automated theorem prover which is generated from a DSL describing rewrite rules (you can see some examples here and here).

Finally, it turns out this is not the first time I’ve done this either!  My last project was building a Java Compiler from scratch (called JKit) which contains a single file with 33KLOC.  Again, this was automatically generated from an ANTLR grammar of the Java language, and is used to parse source files into an Abstract Syntax Tree.

3 comments to A Source File with 72KLOC!?

  • Warren P

    Wow, your productivity positively SOARED!



  • In IAML I had three levels of generation – a model that would generate a model, that would generate XML, that would then generate Java – and I had 7-12 of these original source models.

    Luckily I learnt early on how to automate it enough so I didn’t need to check in the final MLOC 🙂

  • I had a similar boost to my LOC ego (and consequently my Ohloh net worth) when I checked in some .c files containing thousands of rows of test data. Luckily Ohloh lets a list of ignored files be specified — see Settings :: Code locations :: Edit ignored files.

Leave a Reply




You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>