forked from ryukinix/lisp-insights
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finished Chapter 17: Domain Specific Languages
On this chapter we explore the utilities of using macros to defined sub-languages in Lisp to solve a subset of problems in a desired domain. The chosen areas for this example was a macro-system of tags for XML, HTML and SVG. Later was defined a game-action macro to create dynamically functions command for the TEXT ADVENTURE GAME written in the Chapter 5~6. Pretty nice. What I've learned: * When you need to do some weird programming for a very specific domain, Macros are a great solution. With them, you can create your own DSL. * Often, it makes sense to first write a helper function for a macro (like print-tag), and then write a macro (like tag) to add improvements that only a macro can provide. These improvements usually involve being able to access the code with a clearer, and often safer, syntax. * You can mix DSLs with regular Lisp code, which gives you a lot of power * DSLS are useful when you need to write very specific code — whether it's code for a web page, code that draws a picture, or code that builds special game commands.
- Loading branch information
Showing
3 changed files
with
121 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.