Fixed definition of *ps-lisp-library*.
[clinton/parenscript.git] / docs / internal / architecture.txt
1 This document is about the design and architecture of the Parenscript compiler.
2
3 Compilation Pipeline:
4
5 user --> [parenscript text]
6 -- reader --> [parenscript sexp forms]
7 -- parser --> [special forms]
8 -- optimizer --> [(javascript) special forms]
9 -- translater --> [javascript text]
10 -> user
11
12 ==reader==
13 Parenscript can use either the Lisp reader or the Parenscript reader to read objects from source
14 text. Generally, Parenscript embedded in Lisp will use the Lisp reader, and Parenscript in
15 Parenscript files will use the Parenscript reader. There are only a few differences between
16 the readers:
17 # The Parenscript reader will not obey defined read macros in the Lisp reader
18 # The Parenscript reader understands Parenscript package names as package prefixes and
19 does NOT understand Lisp package names as package prefixes.
20 # The Lisp reader does not understand Parenscript package names but does understand
21 Lisp package names as symbol prefixes.
22
23 ==parser==
24 Once the source text has been transformed into SEXPs, the parser transforms the SEXPs into
25 primitive special-form objects. This is the stage during which macroexpansion takes place
26 and an AST is generated for the program.
27
28 ==optimizer==
29 The compiler then performs optional optimizations on the AST produced by the parser. The
30 result is an AST that produces faster/better code.
31
32 ==transformer==
33 Given an AST, the transformer produces Javascript source text.
34
35 *************************************************************************************