Theme index -- Keyboard shortcut: 'u'  Previous theme in this lecture -- Keyboard shortcut: 'p'  Next slide in this lecture -- Keyboard shortcut: 'n'LAML
26.  An introduction to LAML

LAML means 'Lisp Abstracted Markup Language'. LAML is a software package written by the author of this material. The purpose of LAML is to support web development in Scheme - both of static materials and of server-side applications.

In the first and the main part of this material we have used LAML whenever possible, to illustrate functional programming in Scheme with examples from the web domain. We are now ready for a more solid introduction and description of LAML.

26.1 HTML documents in LAML26.3 Programmatic authoring
26.2 Authoring of web materials26.4 LAML: Lisp Abstracted Markup Language
 

26.1.  HTML documents in LAML
Contents   Up Previous Next   Slide    Subject index Program index Exercise index 

We start gently by taking a look at a very simple HTML document - see Program 26.1.

The document in Program 26.1 can be accessed via [initdoc].

We introduce LAML by studying the LAML counterpart of a very simple HTML document

1
2
3
4
5
6
7
8
9
10
11
12
<html>
   <head> 
     <title>This is the document title</title>
   </head>
   <body>
      <h1>Document title</h1>
      <p>Here is the first paragraph of the document</p>
      <p>The second paragraph has an <em>emphasized item</em>
         and a <b>bold face item</b>.
      </p>
   </body>
</html>
Program 26.1    A very simple HTML document that illustrates the overall HTML document structure.

The LAML counterpart of Program 26.1 is shown in Program 26.2. Each HTML element instance used in Program 26.1 is available in Scheme as a function. The set of such functions are called a mirror of HTML in Scheme. In Chapter 27 we will study the HTML mirror functions in details.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
(html
 (head 
  (title "This is the document title")
 )

 (body 
  (h1 "Document title")

  (p "Here is the first paragraph of the document")

  (p "The second paragraph has an" (em "emphasized item")
      "and a" (b "bold face item") _ ".")
  )
)
Program 26.2    The same document as an LAML expression.

The final document on this page, Program 26.3, shows a complete LAML document. The red parts of the program make up the differences between Program 26.2 and Program 26.3. The first two lines of the red parts load the necessary software. The write-html clause renders the HTML document to text, and it writes the HTML document to a file in the file system.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
(load (string-append laml-dir "laml.scm"))
(style "simple-html4.01-transitional-validating")

(write-html '(raw prolog epilog)
 (html
  (head 
   (title "This is the document title")
   )

  (body 
   (h1 "Document title")

   (p "Here is the first paragraph of the document")

   (p "The second paragraph has an" (em "emphasized item")
      "and a" (b "bold face item")_".")
   )
  )
)     
Program 26.3    The document from above embedded in the LAML framework.

The document generated by Program 26.3 can be accessed via [lamldoc].

 

26.2.  Authoring of web materials
Contents   Up Previous Next   Slide    Subject index Program index Exercise index 

We leave the HTML mirror functions temporarily. We come back to them in Chapter 27. Here we will give an overview of ways to produce web materials. Our main purpose with this section is to put our approach - programmatic authoring - in perspective and in relation to more well-known and more commonly used techniques.

Several different approaches to web authoring can be identified

  • Writing the document in a markup language

    • HTML - low level and non-extensible

    • XML - requires subsequent transformations or specification of the document rendering

  • Using a visual tool - a structure editor on top of the markup language

    • Good for low skill users

    • Difficult to manage large and complex materials

  • Transforming the document from another format

    • Will often result in a web edition of a paper document

    • Difficult to make effective use of the WWW's hypertext potentials

  • Writing the document in a programming language

    • Potentially good for users with programming skills

    • To be explored in this lecture

In the next section we define and describe the last approach - programmatic authoring - in more details.

 

26.3.  Programmatic authoring
Contents   Up Previous Next   Slide    Subject index Program index Exercise index 

Programmatic authoring is the idea behind the use of LAML for creation of static web pages.

Using programmatic authoring the document source is a program written in a programming language. By executing the program, the document source program is transformed to another format, typically HTML.

The generation of HTML upon execution of a programmatically authored document can be questioned. It can be argued that several possible kinds of processings and transformation can be imagined. Why bind the program execution to a single kind of processing?

In LAML we have more recently prepared for an intermediate document representation, which is produced when a document is processed. This is part of the XML-in-LAML approach, which we touch on in Section 28.4. This document representation is akin to abstract syntax trees. Thus, when evaluating an expression such as the one in Program 26.2 in a context where all the mirror functions and defined, an abstract syntax is returned. This intermediate representation can be rendered as textual HTML, or it can be processed in another direction.

  • Expected advantages of programmatic authoring

    • We can use all the 'programming tricks' in the web authoring area

      • Authoring of complex materials parallels creation of non-trivial programs

    • Programmatic authoring is probably not feasible in many main stream languages

      • Java, C++, C, Pascal, Perl, ...

Using programmatic authoring the power of a programming language is available everywhere in the document, and at any time in the authoring process

 

26.4.  LAML: Lisp Abstracted Markup Language
Contents   Up Previous Next   Slide    Subject index Program index Exercise index 

LAML means Lisp Abstracted Markup Language

  • LAML fundamentals:

    • The Scheme programming language itself

    • Mirrors of HTML and XML languages in Scheme

    • A number of useful libraries

    • A number of LAML document styles

    • A number of LAML tools

    • An Emacs Environment for practical use of LAML

Briefly stated, but also somewhat simplified, we can summarize LAML as follows.

LAML = Scheme + The HTML and XML mirrors

 

26.5.  References
[Initdoc]The initial HTML document as rendered in a browser
http://people.cs.aau.dk/~normark/prog3-03/html/notes/external-html/initial-document.html
[Lamldoc]The LAML generated document as rendered in a browser
http://people.cs.aau.dk/~normark/prog3-03/html/notes/external-html/doc1.html

Generated: Tuesday July 2, 2013, 09:16:05
Theme index -- Keyboard shortcut: 'u'  Previous theme in this lecture -- Keyboard shortcut: 'p'  Next slide in this lecture -- Keyboard shortcut: 'n'