comp.lang.ada
 help / color / mirror / Atom feed
From: "Yannick Duchêne Hibou57" <yannick_duchene@yahoo.fr>
Subject: Re: Literate Programming
Date: Mon, 7 Sep 2009 20:51:08 -0700 (PDT)
Date: 2009-09-07T20:51:08-07:00	[thread overview]
Message-ID: <eae3e639-6a5e-42f5-8dc4-b8333afb0a23@o10g2000yqa.googlegroups.com> (raw)
In-Reply-To: uzl979mk8.fsf@stephe-leake.org

Thanks for this constructive reply

Before I go on, I have to say that I exploring solutions in the same
spirit of a previous thread I've opened about Ada and UML. After some
attempts, I did not felt fully at ease with UML and Ada for the time,
so I'm still trying to evaluate and envisage other possible solutions.

On 7 sep, 10:38, Stephen Leake <stephen_le...@stephe-leake.org> wrote:
> As I understand it, that can be considered a meta-language, that mixes
> LaTeX and Ada source in one file, and provides tools to split them out
> into files that the relevant compilers will accept.

Yes and no, not exactly. This split a program in parts with markups,
and makes multiple views on an overall. Multiple views are possible
because of the ability to make reference to these parts. I.e. a view
is made of a particular organization of some parts which are
introduced into it via references (a part does not belong to a
particular view, except with CodeBrowser which is different).

The basic idea in literate, is that the implementation approach is not
the same as the understanding approach. A quick image could be to
point that when one figure out how something works, his/her wordings
may introduce B before A, while the implementation may requires A to
be defined before B (different process, different requirements). This
is just an example, just think about the idea that the understanding
process is not the same as the implementation process.

A fundamental function of literate, is called tangling. This is the
function which take one view which purpose is to be the implementation
view and combines parts as referenced in this view, to make up the
implementation. It produce an output which is the implementation
expected by the language.

Let say you have two parts in you program (to keep it simple), which
are A and B. There may be one ore more understanding view making
references to A and B, and there is an implementation view, which
stand for the program construction. This view will make reference to A
and B in the desired order, I mean the order expected by the language
and the compiler. The tangling command appends content of A and B to
create the program construct.

But there are other way to do. Leo does that in that way, while
CodeBrowser does that in a different way, which does not requires
tangling (I don't wish to tell more about differences between Leo and
CodeBrowser, to keep these wordings enough short).

> > So I was wondering if someone has ever heard about some extentions to
> > GPS which would give it literate programming facilities.
>
> What, exactly, is missing from GPS?
Markup driven folding (nodes), that's all, and may be the ability to
follow links to these folders/nodes
This is just a matter of layout and UI, not at all a matter of GPS
functionalities targeting Ada and the build process.

> You have the ability to run external tools, to do the splitting.
This is exactly the opposite which is needed.

> I guess syntax colorization is confused; it needs to know when to
> apply LaTeX, when to apply Ada.
Dear, you can keep simple minds and forget about LaTex formatting ;)
This is just one particular folk, basically, human readable
documentations in literate is just comments, and weither or not it is
formated, is not a particular focus. This can simply be Ada comments.
There is not requirement at all for it to be LaTex. This can range
from raw text to anything one may wish.

> You can't preserve the navigation facilities, treating the
> literate file as the source; pragma Source_Reference only changes the
> file name, not the line numbers. That's a GNAT limitation; you could
> petition them for a more powerful Source_Reference pragma (but you'd
> probably have to come up with some money to get it).
I don't bother about it and I'm not requiring anything any way, I'm
just talking and seeking for knowledge about a particular subject (and
seeking for solutions).

> I prefer using separate LaTeX and Ada files, and referencing one from
> the other appropriately. That preserves all the navigation facilities
> in both languages. If you include the relative file name in a comment,
> Emacs can easily navigate between the files; I don't know if GPS will
> do that.
You bring something very interesting in the area. I was also precisely
too thinking about how to make reference to a document from GPS in an
Ada source. I was wondering if there is already a standardized comment
syntax for it. I've noticed that in GPS, comments whose content does
start start with a space (or the two spaces which the Ada world seems
to prefer), then it is colorized differently. So I was thinking there
may be some convention for type of comments (or perhaps this is only
intended to SPARK language shipped in comments and to nothing else).

If there is a way to give a reference to a document and to be able to
open it from GPS with a simple click or menu command, this may be
nice. I was thinking this is perhaps possible with scripting, although
I do not know a lot about scripting GPS. But I was mainly wondering
about what the format of this kind of comments should and weither or
not such a kind of comments (standing for an URI to a document) has
already been standardized of not.

> As you say, one of the prime features of literate programming is
> providing structure for unstructured languages. Ada doesn't need that :).
The same way Ada is not only useful for very big project and project
where preserving humans life matter and can be useful as well for
smaller project, the same way, literate is not only useful for flawed
languages (I apologize, I mean targeting some area only). As I said
before, I was back to this idea I was not fully satisfied with UML
(which I did not already left anyway... I'm still seeking).

> I don't know for sure, but I bet there's an Emacs mode for literate
> programming :). I know there is support in general for "multiple modes
> in a single buffer", for JavaScript embedded in html.
I'm not running UNIX.

>
> --
> -- Stephe

Thanks Stephe



  reply	other threads:[~2009-09-08  3:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-06  3:08 Literate Programming Hibou57 (Yannick Duchêne)
2009-09-07  8:38 ` Stephen Leake
2009-09-08  3:51   ` Yannick Duchêne Hibou57 [this message]
2009-09-08  7:09     ` Jean-Pierre Rosen
2009-09-08 10:06       ` AdaMagica
2009-09-09  9:47         ` Jean-Pierre Rosen
2009-09-08 11:04       ` Yannick Duchêne Hibou57
2009-09-08 12:14         ` Martin
2009-09-08 16:30           ` Yannick Duchêne Hibou57
2009-09-08 16:51             ` Martin
2009-09-09  8:00     ` Stephen Leake
replies disabled

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