[project @ srid@nearfar.org-20071118130611-f4indxueyaz0v55j]
[boalisp.git] / README
blob80db44f1a5eca95a695fa05c3416999760b86abd
1 Boa Lisp
2 ========
4 The Boa Lisp compiler, written in MzScheme, compiles s-exps to Python
5 byte-code, which can be executed using the Python interpreter
6 itself. This would inevitably provide the developer with Macros and
7 other intuitive powers of Lisp. Thanks to SYNTAX-CASE macros in
8 Scheme, I could implement the parser, and perhaps macros too, using
9 the READ function. The rest is trivial. FFI is used to call AST
10 functions in `libpython` to generate the final byte-code.
12 Consider the following script, taken from the examples in Boa Lisp:
14     (import web)
16     (set! urls (:tuple "/(.*)" "hello"))
18     (class hello ()
19       (def GET (self name)
20         (if (not name)
21             (set! name "world"))
22         (for c in (xrange (int "10"))
23              (print "Hello," (+ name "!")))))
25     (if (= __name__ "__main__")
26         (web.run urls (globals))
27         (print "eek!"))
29     (set! h (hello))
30     (h.GET "")
32 This is the Hello World [web.py](http://webpy.org/) example. It can be
33 compiled and run,
35     $ mzscheme -r compile.ss hello.boa hello.pyc
36     $ python hello.pyc
38 I think, this is neat so far. Imagine being able to import Boa modules
39 from Python and vice versa, which can be performed using import
40 hooks. Although I am being listless nowadays when it comes to this
41 project, I definitely want to complete the most wanted features like
42 mapping AST nodes to corresponding forms in s-exp with line number
43 information which would help in debugging the script. Furthermore,
44 having able to write Boa apps using the popular frameworks and
45 libraries like Twisted, Django, etc.. would prove to be very useful.
47 Contents:
49 syntax-case.patch:  Incomplete patch to replace `match.ss` with SYNTAX-CASE