comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@acm.org>
To: comp.lang.ada@ada-france.org
Subject: Re: Literate Programming in Ada, AdaDoc, AdaBrowse
Date: 10 Oct 2004 11:13:36 -0400
Date: 2004-10-10T11:13:36-04:00	[thread overview]
Message-ID: <mailman.258.1097422284.390.comp.lang.ada@ada-france.org> (raw)
In-Reply-To: <2sqmccF1oit5sU1@uni-berlin.de>

Nick Roberts <nick.roberts@acm.org> writes:

> I've been struggling with the question of how best to do the
> documentation accompanying open source Ada projects. It is especially
> important that the maintenance (as well as user) documentation is
> present, usable, and itself continuously maintainable, for this kind
> of project.

That is certainly important.

> I've tinkered with DocBook, Texinfo, and other systems (even trying
> to invent one of my own). I've attempted to add 'literate
> programming' functionality to these systems.

I use Texinfo or LaTeX, for things that are too complex for Ada
comments.

> <snip description of Literate programming>

I agree, LP is not a good choice.

However, I think the motivation behind LP is still valid. That is,
"find a way to keep documentation up to date". The LP approach to that
is to integrate the documentation source with the code source. But I
think the reason that works is developers can easily edit
documentation and code source _within the same editor_. That suggests
a different approach; different files and syntax for documentation
source, but an Integrated Development Environment that can handle both
with ease. Emacs and GPS and others are such an IDE for Ada, Texinfo,
and LaTeX.

> An alternate approach has been the idea of a mechanism to update the
> web files from changes made directly in the source code files, but
> this technique does not seem to have got very far.

This is what AdaBrowse does. Since it is based on comments in the Ada
code, I don't think it solves the problem of how to document "things
that are too complex for Ada comments". It can produce nice summaries
of packages and type heirarchies, which is also a good thing; it helps
people learn how the code works, and/or how to use the code.

> Up to now, I've been opposed to the idea of putting the main
> (maintenance) documentation directly into the Ada source files
> (particularly the package specifications), on the grounds that this
> prevents the use of existing document preparation systems.

I think it is more important to focus on the information presented,
and less on the mechanism to do that.

There are some design decisions that simply can't be documented nicely
in Ada comments. For a simple example, the design rule that all
constructors should be declared in nested packages. You don't want to
repeat that in every package, and you don't want to designate one
package as the "prime document package". For a more complex example,
the documentation of how signals are handled in Gtk needs its own
separate document.

> * If a line begins with "-- " (not indented), it and any immediately
> following non-blank lines are word-filled. Before word-filling, any
> "-- " at the beginning of a line is removed. After word-filling, every
> output line is prefixed by "-- ". Words are simply delimited by
> whitespace (there's no hyphenation or other fancy stuff).

Emacs Ada mode does this. So does GPS. I consider this a minimum
requirement for any IDE. (In my opinion, PFE is _not_ a good IDE).

> * If a line begins with "--+", the remainder of the line is taken to
> be a pathname of a text file, whose contents are read. All following
> lines up to (but not including) a line beginning with "---" are
> deleted. The lines read from the text file are inserted, after
> having macro substitutions performed (as described next).

Why would this be useful? If you want it, use --#include; at least it
will be recognized.

> * Any occurrance of "${" followed by a name-string and then "}" is
> replaced by another string according to the name-string, iff the
> name-string is recognised.
> 
> Recognised name-strings are:
> 
> * "LINE", which is replaced by the current line number in the source
> file;

What, exactly, does this mean? The line number before or after all (or
some?) substitutions are made? See the C preprocessor for possible
answers to this question.

> * "FILE", which is replaced by the full pathname of the source file;
> 
> * "DATE", which is replaced by the current date and time.

Why would these be useful? These are configuration management issues,
not design documentation issues.

"Current" when the file is loaded into the IDE? when the file is
processed by this tool? When the file was last written to disk? None
of these are very meaningful.

> I also propose writing another quite simple Ada program which will
> generate an HTML rendition of an Ada source file. 

AdaBrowse does this. If you think it needs more features, please add
them. Leverage other people's work, don't re-invent it.

> Also being able to generate an Texinfo rendition might be very handy,
> as well as XML (DocBook), TeX, or other formats.

Exactly _why_ would these be handy? You are proposing a lot of work,
with very little justification.

I want documentation to be fully searchable. I find it hard to search
a collection of html pages, but you could argue that's a browser
function. For example, Texinfo is searchable only because the Emacs
Info browser supports it. Any Open Source format that is fully
searchable via an Open Source browser is fine with me. 

Hmm. I really do prefer the browser to be integrated with the IDE
(Emacs in my case). I believe the bleeding edge Emacs can display
rendered HTML, even on Windows. But I still want full searching.

> There are two reasons why I have an objection to the use of ASIS:
> AdaBrowse cannot be used on a source file which cannot be compiled
> (e.g. because it is still in an early state of development, or it has
> an unresolved error in it); 

Why is this a problem? In my opinion, you run AdaBrowse only when you
do a release of a project (that's what I do for SAL). The generated
documentation is for people who need to learn the package, not for the
package developer; the Ada code and comments should be good enough for
them.

> a compiler which supports ASIS must be available. 

Well, the only Open Source Ada compiler is GNAT, and ASIS is available
for it. So this is a moot point (for a fully Open Source project).

> It does seem almost like using a sledgehammer to crack a nut.

ASIS is a way to access the Ada parser in the compiler front end. Any
tool that parses Ada code should use the compiler front end; otherwise
it's duplicating work. Not to mention probably wrong.

Learning to use ASIS well does take time. Perhaps for "a simple
comment parser", you don't need to parse the Ada code. But I don't
think the results of "a simple comment parser" would be worth having.

Learning to add to AdaBrowse should be simpler than learning to use
ASIS from scratch (I have not looked at the AdaBrowse sources). I
suggest you give it a try.

-- 
-- Stephe




  parent reply	other threads:[~2004-10-10 15:13 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-09 17:44 Literate Programming in Ada, AdaDoc, AdaBrowse Nick Roberts
2004-10-09 18:39 ` Wes Groleau
2004-10-09 21:04   ` Nick Roberts
2004-10-09 21:39     ` stephane richard
2004-10-09 23:40     ` Wes Groleau
2004-10-10 16:39     ` Simon Wright
2004-10-12  0:42       ` Georg Bauhaus
2004-10-11  7:33     ` Ole-Hjalmar Kristensen
2004-10-09 19:21 ` Pascal Obry
2004-10-09 21:47   ` Nick Roberts
2004-10-09 23:20     ` Björn Persson
2004-10-10  8:28       ` Oliver Kellogg
2004-10-10 10:03         ` Björn Persson
2004-10-10 15:27           ` Stephen Leake
2004-10-09 23:49     ` Wes Groleau
2004-10-10 10:36     ` Pascal Obry
2004-10-10 11:26       ` Marius Amado Alves
2004-10-18  8:17         ` Jacob Sparre Andersen
2004-10-18 11:15           ` Marius Amado Alves
2004-10-18 12:46             ` Björn Persson
2004-10-18 15:39               ` Marius Amado Alves
2004-10-18 13:47             ` Jacob Sparre Andersen
2004-10-09 22:54 ` Lionel Draghi
2004-10-09 22:56 ` Björn Persson
2004-10-09 23:55   ` Wes Groleau
2004-10-10  1:02     ` Björn Persson
2004-10-10 14:02       ` Wes Groleau
2004-10-10  3:29 ` Steve
2004-10-10 14:08   ` Wes Groleau
2004-10-10 15:06     ` Steve
2004-10-10 15:20   ` Stephen Leake
     [not found]   ` <rlsfz4jdjuj.fsf@jacob.crs4.it>
2004-10-15 13:33     ` Marius Amado Alves
2004-10-16  1:50     ` Steve
2004-10-16 19:46       ` Jacob Sparre Andersen
2004-10-17  3:46         ` Steve
2004-10-10  8:21 ` Stephane Riviere
2004-10-11 23:02   ` Björn Persson
2004-10-11 23:31     ` Missing features in NaturalAdaBrowseDoc Lionel Draghi
2004-10-12  0:14       ` tmoran
2004-10-12 12:58       ` Marc A. Criley
2004-10-12 21:20         ` Lionel Draghi
2004-10-12 17:49       ` Stephane Riviere
     [not found]         ` <416c48a7$0$28918$636a15ce@news.free.fr>
2004-10-12 21:18           ` Lionel Draghi
2004-10-13 16:38           ` Stephane Riviere
2004-10-14 19:56             ` Lionel Draghi
2004-10-15 16:59               ` Stephane Riviere
2004-10-12 17:29     ` Literate Programming in Ada, AdaDoc, AdaBrowse Stephane Riviere
2004-10-10  9:34 ` Andre
2004-10-10 15:24   ` Stephen Leake
2004-10-10 18:04     ` Andre
2004-10-11 23:32     ` Lionel Draghi
2004-10-12  0:13       ` Björn Persson
2004-10-10 15:13 ` Stephen Leake [this message]
2004-10-11 20:28 ` Nick Roberts
2004-10-11 22:26   ` Björn Persson
2004-10-12 14:09     ` Nick Roberts
2004-10-13  5:01       ` Pylinius
2004-10-13 16:06         ` Nick Roberts
2004-10-13 17:17     ` Pascal Obry
2004-10-17 18:47   ` Bernhard Mulder
2004-10-18 18:06     ` Nick Roberts
2004-10-19  4:41       ` Bernhard Mulder
2004-10-19  9:52         ` Peter Hermann
2004-10-19 10:01         ` Nick Roberts
2004-10-23 21:39           ` Bernhard Mulder
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox