Linux written in Lisp!
Tuesday, January 27, 2004
Well, partially at least. ;-)
This article provides a breakdown of the programming languages
used to create a popular Linux distribution (RedHat
7.1) and their relative rankings by SLOC (source lines of code). Interestingly, Lisp places 4th (after C, C++, and Bourne-like
Shell code). It is interesting to speculate how Lisp would place in
this table if a different metric was used. For example, if Lisp
macro code was expanded, the Lisp SLOC figures would undoubtedly exceed the
Shell SLOC count, moving Lisp up to third place. If level of abstraction was factored in as well,
undoubtedly Lisp would move even higher (probably surpassing C++ as
the second-place language. Of course, this just goes to show you that
SLOC really means little when comparing different programming
languages; however, the next time you get into an argument with
someone about where Lisp is used in mainstream products, these figures
might prove useful!
Here is a breakdown of the numbers:
| Language | SLOC (%) |
| C | 21461450 (71.18%) |
| C++ | 4575907 (15.18%) |
| Shell (Bourne-like) | 793238 (2.63%) |
| Lisp | 722430 (2.40%) |
| Assembly | 565536 (1.88%) |
| Perl | 562900 (1.87%) |
| Fortran | 493297 (1.64%) |
| Python | 285050 (0.95%) |
| Tcl | 213014 (0.71%) |
| Java | 147285 (0.49%) |
| yacc/bison | 122325 (0.41%) |
| Expect | 103701 (0.34%) |
| lex/flex | 41967 (0.14%) |
| awk/gawk | 17431 (0.06%) |
| Objective-C | 14645 (0.05%) |
| Ada | 13200 (0.04%) |
| C shell | 10753 (0.04%) |
| Pascal | 4045 (0.01%) |
| sed | 3940 (0.01%) |
The following quote from the article provides some more detail on where Lisp is being used in RedHat Linux (unsurprisingly, Emacs represents a major chunk).
"LISP continues to place very highly, far more than Perl, Python, Fortran, or Java. LISP is used in many components, but its high placement is due to the widespread use of emacs. Emacs itself is written in primarily in its own variant of LISP, and the emacs package itself accounts for 87% (627626/722430) of the LISP code. In addition, many languages include sophisticated (and large) emacs modes to support development in those languages. Perl includes 5739 lines of LISP, and Python includes another 2353 of LISP that is directly used to support elaborate Emacs modes for program editing. Other programs (such as the GIMP and Sawmill) also use LISP or one of its variants as a ``control'' language to control components built in other languages (in these cases C). LISP has a long history of use in the hacking (computer enthusiast) community, due to powerful influences such as MIT's old ITS community. For more information on the history of hackerdom, including the influence of ITS and LISP, see [Raymond 1999]."

