texmacs-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Texmacs-dev] literate programming for TeXmacs


From: David MENTRE
Subject: Re: [Texmacs-dev] literate programming for TeXmacs
Date: Tue, 17 Jan 2006 15:34:34 +0100

Hello Felix,

2006/1/16, Felix Breuer <address@hidden>:
> I started working on a proper plugin for TeXmacs, but then realized that for
> that system to be really useful, it would need the capability to automatically
> update the code in the .tm file when the code in the generated files is 
> changed.
> This capability is what makes Leo [1] a great tool. I will call it roundtrip
> literate programming below.

I'm also interested by Literate Programming and how TeXmacs
capabilities could be used for this. I am currently using a basic
literate programming tool (noweb) on a reasonably complex project
(OCaml, XDR, Makefile and CDuce languages are used simultaneously for
example). Noweb is far from being statisfying. For example, recent
TeXmacs capabilities to make drawings could be very useful.

However, I'm also used to work with proprietary environments on
Windows platform (Intel's IXP SDK or Xilinx's ISE for example) and
with them, it is quite difficult to use usual literate programming
tools because the IDE have there own way of managing files and
generate them, and you can't change that (or only with great
difficulty).

You are suggesting a first solution to this kind of issue by using a
round trip approach, where, if I understood correctly, the generated
code can be modified and an automatic tool can re-integrate those
modifications into the original .tm literate document.

I would suggest another approach: embed the TeXmacs literate parts as
comments into the original source file.

The literate TeXmacs plugin would be able to parse those comments, as
well as recognizing code parts, and it would display them in the
reverse way: literate comments are editable TeXmacs sections while
uncommented code appears as code blocks. Then, one would have the full
power of TeXmacs to make graphics, indexes, cross-referencing,
formulas, etc. When saving the document, the literate part would be
saved as comments, while the code part would be actual code. I hope my
explanation is clear. :-)

The main advantage of this approach:

  - it works with all languages, with or without proprietary IDE. Not
need to modify makefiles to make it work, no need to modify your
Subversion rules;

 - the approach seems to me of moderate complexity: you only need a
database of kind of comment per language:
  - comment to the end of line (Lisp, Ada, VHDL, Perl, Python, etc),
  - start/end of comment delimiter, nested (OCaml) or not (C, C++),

   One could use a simple naming scheme, for example "file.tm.c", to
find literate sources;

  - TeXmacs already support multiple file document, so all sources of
a project could be aggregated into a single TeXmacs document.

Originally, I thought of using a Wiki-like syntax for literate
comments, but TeXmacs offers much powerful editing capabilities.

What do you think of it?

Best wishes,
david




reply via email to

[Prev in Thread] Current Thread [Next in Thread]