[erlang-questions] erlang source code browser

Richard O'Keefe ok@REDACTED
Fri Sep 14 06:30:28 CEST 2012


I have my own multi-programming-language => multiple markup language
program, and it does handle Erlang, but it doesn't do cross-references.
There are three reasons for this:
(a) it started as a program for transforming code snippets to LaTeX
for inclusion in books, papers, handouts;
(b) because it handles so many languages, some of them with dynamic
syntax, it does no actual parsing, so cannot determine arity of
functions;
(c) thanks to the Erlang preprocessor, and the ability to plug
transformation modules in, you can't actually parse Erlang source
code without *being* Erlang.

Consider this little gem:
-module(ouzo).
-export([pine/1]).

-define(PINE, cone).
-define(BARK, ?PINE(2, (?PINE(1), 3))).

pine(1) -> ?PINE(1);
pine(2) -> ?PINE(2, 3);
pine(3) -> ?BARK.

?PINE(1) -> ok.

?PINE(2, 3) -> ok.

Suppose you have your cursor ?PI<here>NE(1) and you want there to
be a link that will take you to the definition of the function
being called.  It's easy enough to get to the -define line, but
getting to cone/1 is another matter.

Or suppose you have your cursor ?BA<here>RK and you want to link
to "the" function.  Is it cone/1 or cone/2?

Is it any wonder that I jumped up and down shouting
"Delenda est preprocessor!" until I realised I was never going
to get anywhere?

(The best C to HTML tool I know of hooks into a C preprocessor.
I had a bit of a struggle with the installation process because
of that.)




More information about the erlang-questions mailing list