Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: program design language - a reality?

by danger (Priest)
on Feb 21, 2001 at 03:21 UTC ( [id://59795]=note: print w/replies, xml ) Need Help??


in reply to program design language - a reality?

If you are interested, Literate Programming provides much of the benefits of PDL, and additional benefits as well. You describe your program and define it in a series of named 'chunks' -- within a chunk, you may include other chunks. Then you define/refine each chunk. The chunk names are rather like the pseudo-code. The literate source code file may be 'tangled' into an actual source file, or 'woven' into a typeset document (LaTeX, HTML, or some other format depending the tools you are using).

So the root chunk (the chunk that defines the program) might look like (for a program called 'faqgrep'):

<<faqgrep>>= #!/usr/bin/perl -w use strict; <<initialize_variables>> <<read_in_perlfaq_filenames>> <<search_and_print>> <<faqgrep.pod>> @

And then later you'd create the definition for each of those included chunks (and those may include chunks as well). So you get stepwise refinement and flexible order of presentation (we don't have to present those chunks in the order given, though in a case such as above it probably makes more sense to go linearly). Each of these 'chunks' is preceded (and/or followed) by the explanatory text (usually in LaTeX). Tangling assembles the chunks into the proper order to create your source code, and weaving turns it into a typeset document with any indexing and cross-reference features you (and the LP tool) have implemented.

To find out more about LP: The faq is located here, and Mark-Jason Dominus has an article on perl.com. I use the noweb LP tool myself (not religiously though). I've been considering writing up a little introductory LP article for perlmonks, so let me know if you are interested.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://59795]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2024-04-20 03:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found