Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

A. Epilogue > DSL Guild Hot Rods

DSL Guild Hot Rods

Lisp Dialect

Common Lisp

Synopsis

Because Lisp has such a simple syntax (everything is delimited with parentheses), it is easy to use it to build your own custom programming language, designed for a specific domain. Such domain-specific languages (DSLs) tend to make heavy use of the Lisp macro system. They represent an extreme form of macro programming, transforming Lisp into a completely new programming language.

image with no caption

Explanation

This is an example of code that uses a DSL to build an HTML page. In this case, the page displays “Hello World” in a browser, with the second word rendered in bold. The html and body commands (macros created for the HTML library in Chapter 16) generate opening and closing tags that will contain the body of the page . Then it calls the regular Lisp function princ to generate the text. The second word is wrapped in another custom DSL command, bold , which generates opening and closing bold tags around the specified text.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint