forked from toshok/echojs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSTUFF
40 lines (26 loc) · 992 Bytes
/
STUFF
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
* lexer
* parser
* desugar
- get rid of immediately applied functions:
(function () { /* ... */ })();
can become nothing but:
{ /* ... */ }
if there are no 'vars' inside it. if there are, we hoist the
vars to the toplevel of the function and convert them to
lets, then replace it with the { }
* lambda lifting
* optimizations
* ffi
- we need some sort of DSL for external C-linkage functions. bonus points for a syntax that allows objc messages as well.
maybe something like:
@extern void print_internal_i32 (@i32(theInt))
@extern void print_internal_d64 (@d64(theDouble))
@extern void print_internal_string (@string(theString))
function print(theObj) {
if (theObj === null)
print_internal_string ("null");
else if (typeof(theObj) == "undefined")
print_internal_string ("undefined");
else if (typeof(theObj) == "object")
print_internal_string (theObj.toString());
}