Formatting & Typesetting Source Code 
Author Message
 Formatting & Typesetting Source Code

I'm currently attempting to write a literate programming environment
for Perl, based on Knuth's WEB system for Pascal. To do this, however,
I'd like some pointers as to what is considered `tidy' or `acceptable'
source code. Please bear in mind that typeset formatting will be
different to source formatting that may be done by your favourite
editor; would we want a fixed- or proportional- width font? If
proportional, then the indentation would be specified in terms of
measured length, not characters. Should we use, for example, a
left arrow to signify assignment, like Knuth does. Is there a sensible
way to format regular expressions? (Putting reserved words in bold
font is a headache for me at the moment, but we're getting there.)

I've put a few .dvi files created using the current system (which
is just about to undergo a second major rewrite from scratch) up at
http://www.*-*-*.com/ ~pemb0468/webperl/

I'd appreciate comments on how they look and how people think they
ought to look. I know this might become a religious subject, and
that's not what I want. Just some kind of consensus would be nice.
Then again, this is Usenet.

Simon

--
Imbalance of power corrupts and monopoly of power corrupts absolutely.
                -- Genji



Sat, 28 Apr 2001 03:00:00 GMT  
 Formatting & Typesetting Source Code


Quote:
>I'm currently attempting to write a literate programming environment
>for Perl, based on Knuth's WEB system for Pascal. To do this, however,
>I'd like some pointers as to what is considered `tidy' or `acceptable'
>source code.

What sort of "pointers" are you seeking that go beyond whats
in the perlstyle manpage, or Joseph Hall's "Effective Perl"
book (a must read IMHO ;-)

Will you be making use of Perl's POD documentation format at all?
Why or why not? What about SDF (see http://www.mincom.com/mtr/sdf/)
--

 "And miles to go before I sleep."   |  3700+ WWW links on CS & Sw-Eng



Sun, 29 Apr 2001 03:00:00 GMT  
 Formatting & Typesetting Source Code
        >snip<
: Please bear in mind that typeset formatting will be
: different to source formatting that may be done by your favourite
: editor; would we want a fixed- or proportional- width font?

        *FIXED*.  Proportional fonts should *NEVER* be used for code, ever.

: If
: proportional, then the indentation would be specified in terms of
: measured length, not characters. Should we use, for example, a
: left arrow to signify assignment, like Knuth does.

        Huh?  An example please.

: Is there a sensible
: way to format regular expressions? (Putting reserved words in bold
: font is a headache for me at the moment, but we're getting there.)

        See the /x regexp operator (man perlre).  It lets you break
        up regexps with embedded whitespace and comments.

: I'd appreciate comments on how they look and how people think they
: ought to look. I know this might become a religious subject, and
: that's not what I want. Just some kind of consensus would be nice.
: Then again, this is Usenet.

        :-)

--

BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".



Sun, 29 Apr 2001 03:00:00 GMT  
 Formatting & Typesetting Source Code
Simon Cozens:

Quote:
>I'm currently attempting to write a literate programming environment
>for Perl, based on Knuth's WEB system for Pascal.

I'm reminded of a post I sent out to comp.programming.literate some years
back, when I first stumbled across Perl's POD support. I was so delighted that
a mainstream language had included a facility which most everyone was using
for embedding documentation within code and a programmatically-extractable
fashion. So I sent my note out, and closed with something like "only please
don't call it ``Literate Programming'' or nobody will want to do it". Very
very shortly thereafter lwall, who was kiboizing all of usenet for perl
references, followed up with "Call it ``Cultured Perl''". I assume he'd been
waiting for the straight line since he invented POD format. Maybe since he
first invented perl back in the mid-80s.

-Bennett



Mon, 30 Apr 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. View Source Code/ Display Images & URL

2. Script shows source code & executes not

3. Here's Emacs code to track source code during Perl debugging

4. Perl script for formatting C source file

5. Typesetting perl programs in TeX

6. Perl equivalent to typeset -Z2 var needed

7. File format sources sought

8. HTML source formatting

9. pod2latex and interleaved source code

10. Looking for source code reformattors

11. Linus Torvald on Open Source Code

12. Off Topic - Linus Torvalds/Open Source code

 

 
Powered by phpBB® Forum Software