Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 190 lines (124 sloc) 4.683 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
-*- outline -*-

Tamacola - Cola (Scheme like dynamic compiler) on Tamarin

This program is tested with Flash Player 10 and Tamarin 714

* commands

- bin/tamacc Tamacola Compiler
- bin/tamacola Tamacola Shell
- bin/mkswf SWF Archiver
- bin/abcsx ABCSX assembler
- bin/mkpeg PEG to Tamacola Converter

* build

** Run all examples and demos
make run-example

** Recompile commands
make -C bin

** Boot from Ian Piumarta's cola compiler
make boot # Commands in bin/ directory is replaced.

* directories

- bin : Commands are stored
- abcsx : ABC S-expression assembler
- cola : Original Cola source tree
- boot : Tamacola written in Cola
- runtime : Tamacola written in Tamacola itself
- stage2 : A working directory for boot strapping
- tools : Profiler for avmshell and Squeak Moshi
- example
- ws : Workspace on the web browser

* Make target

- make : Recompile
- make boot : Boot strapping from Cola
- make test : Run all test cases
- make all : Do everything
- make count : Current LOC in the project

* Special form

... : repeat
[] : optional

** (), #t, #f, #self, and #undefined

null, true, false, this, undefined in ActionScript respectively.

** (let ((tmp1 value1) (tmp2 value2) ...) exprs ...)
** (let (tmp1 tmp2 ...) exprs ...)

Evaluate expressions with local variables tmp1, tmp2, ...

** (class name (super interfaces ...) (members ...) [constructor])

Create an ActionScript class.

Example:
(class Foo (Object) (first second)
       (lambda (arg) (slot-set! #self first arg)))

** (constructsuper args ...)

Call the constructor of the base class.

** (send object message arguments ...)

Send the message to the object.

** (slot-get object string-or-number)
** (slot-getq object name)
** (slot-set! object string-or-number value)
** (slot-setq! object name value)

Slot accessors.

** (new class args ...)

Make a new instance of the class.

** (not expr)

Boolean negation.

** (instanceof object type)

Return True if object's prototype chain includes a type

** (try-catch variable type try-block finally-block)

When an exception happens in try-block, and it is matched the type, finally-block is run.
See example/exception.k

BUG: try-catch can be used only inside a function (lambda).

** (undefined? name)

Returns true if name is undefined or not defined in this scope.

** (import namespace)

Add the namespace to access variables.

Unlinke the library in R6RS, namespace is a single name instead of a
list of name (I might change it someday). Use name.space instead of
(name space).

Also, slash "/" is used as the delimiter between the namespace and the
local name (Cola/Clojure style). Note that unlike Clojure, slash
does'n mean a class member accessor. Use (slot-getq Math PI) instead
of Math/PI.

** (library namespace exprs ...)

Declare the namespace. All definitions in the exprs are defined in the
namespace.

Example:

(library myproj.mylib
  (define myvar "Hello"))

is equivalent to (define myproj.mylib/myvar "Hello")

* See also

Tamarin
source code: http://hg.mozilla.org/tamarin-central
documentation: https://developer.mozilla.org/En/Tamarin/Tamarin_Build_Documentation

* NOTE: How to build tamarin.

$ hg clone http://hg.mozilla.org/tamarin-central/
$ cd tamarin-central
$ mkdir objdir-release
$ cd objdir-release
$ python ../configure.py --enable-shell --enable-debugger

(in case of Snow Leopard)
$ python ../configure.py --enable-shell --enable-debugger --target=x86_64-darwin

* NOTE: How to run tamacola shell on MinGW

For some reason, the tamacola shell can not handle MinGW nor emacs
console. You should run tamacola from cmd.exe

Open cmd.exe
Type following commands in the console

C:\msys\1.0\bin\sh
PATH=$PATH:/bin:/usr/local/bin
cd stage2/
make tamacola
./tamacola

* NOTE: How to bootstrap Tamacola

(This source tree doesn't include the COLA distribution which is not
published yet for open public, sorry!)

For full-bootstrapping, you need to checkout the COLA distribution to
cola/ directory. COLA.patch must be applied to the COLA source tree
before it is built. COLA.patch allows you to use Scheme style hex
numbers.

$ svn checkout http://cola-c3-trunk-repository cola
(If it answers just svn: REPORT of ...: 200 OK, do it again)

$ (cd cola; patch -p0 < ../cola.diff)
$ make boot

* Download

Tamacola source code:
http://www.vpri.org/vp_wiki/index.php/Tamacola

Demos
* Forall Workspace: http://tinlizzie.org/~takashi/tamacola/forall/Workspace.swf
* COLA Workspace: http://tinlizzie.org/~takashi/tamacola/ws/Workspace.html

Tamarin virtual machine
* For Mac OS X: http://tinlizzie.org/~takashi/tamacola/avmshell-mac.zip
* For Windows: http://tinlizzie.org/~takashi/tamacola/avmshell-win.zip
Something went wrong with that request. Please try again.