├── .gitignore ├── README.md ├── compiler-rjs ├── README.md ├── compiler.rkt ├── compiler2.rkt ├── compiler3.rkt ├── htdp │ ├── colors.rkt │ └── ffi.rkt ├── info.rkt ├── runtime.exports ├── runtime.js └── runtime.rkt ├── compiler-test ├── letrec.tests ├── numbers.tests └── test-suite-compiler.rkt ├── info.rkt ├── urlang-examples ├── README.md ├── demo-fact.rkt ├── info.rkt ├── parabola │ └── parabola.rkt ├── quiz │ └── quiz.rkt ├── ractive │ ├── README.md │ ├── ractive-bootstrap-example.html │ ├── ractive-bootstrap-example.rkt │ ├── ractive-original.rkt │ ├── ractive.js │ └── ractive.rkt ├── raphael │ ├── browser.exports │ ├── browser.html │ ├── browser.js │ └── browser.rkt ├── react │ └── urx.rkt └── space-invaders │ └── space-invaders.rkt ├── urlang-test ├── test-extra.rkt └── urlang-tests.rkt └── urlang ├── README.md ├── extra.rkt ├── for.rkt ├── globals.rkt ├── html.rkt ├── html ├── README.md ├── all.rkt ├── at-html.rkt ├── tag-comparison.rkt └── to-at-exp.rkt ├── info.rkt ├── main.rkt ├── react └── urx.rkt ├── symbol-table.rkt └── tests ├── test-async-and-await.rkt ├── test-const-and-let.rkt ├── test-extra.rkt ├── test-for.rkt ├── test-new-expressions.rkt └── test-operators.rkt /.gitignore: -------------------------------------------------------------------------------- 1 | # The "build" and "bundle" directories are used when creating installers 2 | # via the `server', `client', and/or `farm' maefile targets. 3 | #/build/ 4 | #/bundle/ 5 | 6 | # It's common to configure the PLTADDONDIR to be here. 7 | #/add-on/ 8 | 9 | # This is where to put packages installed with `--clone` 10 | #/extra-pkgs/ 11 | 12 | # Everything below makes sense on any package repository, so it's 13 | # stuff that should be put into each such repository. The same holds 14 | # for ".mailmap" (which some people can decide if they want to thin it 15 | # out or not include it) and for ".gitattributes" (which is probably 16 | # irrelevant except maybe for the core repo). 17 | 18 | compiled/ 19 | 20 | # common backups, autosaves, lock files, OS meta-files 21 | *~ 22 | \#* 23 | .#* 24 | .DS_Store 25 | *.bak 26 | TAGS 27 | 28 | # generated by patch 29 | *.orig 30 | *.rej 31 | 32 | # coredumps 33 | *.core 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # URLANG 2 | 3 | > Urlang is JavaScript with a sane syntax 4 | 5 | Urlang is a language designed to allow straightforward translation to JavaScript. 6 | Think of Urlang as JavaScript with sane syntax and JavaScript semantics. 7 | JavaScript in this context is short for ECMAScript 5 in strict mode. 8 | 9 | Although the constructs of Urlang and JavaScript map almost one-to-one, 10 | a little sugar was added: 11 | * function definitions allow default arguments 12 | * let expressions 13 | 14 | Even though the syntax of Urlang is Racket-like, remember that the 15 | semantics is standard JavaScript. This means in particular that tail calls 16 | build context. 17 | 18 | 19 | ## Examples 20 | 21 | The following examples are compiled using the `urlang` form. 22 | 23 | (urlang ...) 24 | 25 | The urlang form compiles the modules. The result of compiling 26 | a module is saved a file whose path is the module-name with `.js` 27 | added. 28 | 29 | The `urlang` form is controlled by the following parameters: 30 | 31 | (current-urlang-run? #t) ; compile and run (using node) 32 | (current-urlang-echo? #t) ; print JavaScript to screen 33 | (current-urlang-console.log-module-level-expr? #t) ; use conole.log to print module-level exprs 34 | 35 | 36 | ### Example (factorial) 37 | 38 | > (urlang 39 | (urmodule fact ; module name 40 | (export fact) ; fact is exported 41 | (import + - * = displayln ref console) 42 | (define (fact n) (if (= n 0) 1 (* n (fact (- n 1))))) 43 | (fact 5))) 44 | 45 | The generated JavaScript: 46 | 47 | "use strict"; 48 | function fact(n){return (((n===0)===false)?(n*(fact((n-1)))):1);}; 49 | console.log((fact(5))); 50 | exports.fact=fact; 51 | 52 | The output from Node: 53 | 54 | "120\n" 55 | 56 | 57 | ### Example (`cond`-macro and `array`) 58 | 59 | Urlang macro transformers receive and produce standard Racket syntax objects. 60 | This implies that standard tools such as syntax-parse are available. 61 | 62 | Consider an Urlang version of `cond`: 63 | 64 | SYNTAX (cond [e0 e1 e2 ...] ... [else en]), 65 | like Racket cond except there is no new scope 66 | 67 | The urlang macro transformer is an standard (phase 0) Racket function. 68 | 69 | (define-urlang-macro cond 70 | (λ (stx) 71 | (syntax-parse stx 72 | [(_cond [else e0:Expr e:Expr ...]) 73 | #'(begin e0 e ...)] 74 | [(_cond [e0 e1 e2 ...] clause ...) 75 | (syntax/loc stx 76 | (if e0 (begin e1 e2 ...) (cond clause ...)))] 77 | [(_cond) 78 | (raise-syntax-error 'cond "expected an else clause" stx)]))) 79 | 80 | The macro can now we be used: 81 | 82 | > (urlang 83 | (urmodule sum-example 84 | (define (even? x) (=== (% x 2) 0)) 85 | (var (sum 0) x (a (array 1 2 3 4 5)) (i 0) (n a.length)) 86 | (while (< i n) 87 | (:= x (ref a i)) 88 | (cond 89 | [(even? x) (+= sum (ref a i))] 90 | [else "skip"]) 91 | (+= i 1)) 92 | sum)) 93 | 94 | The generated JavaScript: 95 | 96 | "use strict"; 97 | function even_p(x){return ((x%2)===0);}; 98 | var sum=0,x,a=[1,2,3,4,5],i=0,n=a.length; 99 | while((i JavaScript 112 | 113 | that compiles an urlang module and produces JavaScript, 114 | that can be evaluated by the Node.js platform (or be embedded in a web page). 115 | 116 | The Urlang module to be compiled can be represented 117 | 118 | 1. as a syntax object 119 | 2. as a Nanopass structure (representing an Lurlang program) 120 | 121 | Use 1) to program in Urlang directly. 122 | 123 | Use 2) if you intend to use Urlang as a compiler backend. 124 | 125 | [Note: Nanopass is a framework for implementing compilers.] 126 | 127 | The intended use of Urlang is to use 1) to write (generate) a Racket runtime in JavaScript. 128 | The middle-end of the Racket-to-JavaScript compiler will produce output as Nanopass 129 | structures, so 2) will be used as the backend for the Racket-to-JavaScript compiler. 130 | 131 | Internally the function expand 132 | 133 | expand : syntax -> LUrlang 134 | 135 | will parse and expand its input and produce an LUrlang representation. 136 | 137 | Note that `expand` allows the user to extend the input language 138 | using define-urlang-macro. An Urlang macro is a syntax to syntax 139 | transformation implemented as a normal Racket function. 140 | This allow you to use all of the standard Racket macro machinery. 141 | 142 | Main functions: 143 | 144 | expand : syntax -> Lurlang 145 | expand the input and produce a fully expanded Urlang program 146 | represented as a Lurlang structure 147 | 148 | compile : syntax -> 149 | Expand and compile. The output is written to standard out. 150 | 151 | eval : syntax -> value 152 | expand, compile and run the input (an Urlang module represented as a syntax object) 153 | Running means that `node` is used to run the generated JavaScript. 154 | 155 | Having Urlang as a `#lang` language allows 156 | 157 | * macros (using full Racket at compile time) 158 | * export of defined names 159 | * easier testing 160 | 161 | In the grammar below: 162 | 163 | - `x` stands for a non-keyword identifier 164 | - `f` stands for an identifier defined as a function 165 | 166 | ```` 167 | ::= (urmodule ...) 168 | 169 | ::= | | | 170 | ::= (export x ...) 171 | ::= (import x ...) 172 | ::= (define (f ...) ) 173 | | (define x ) 174 | ::= x | [x ] 175 | 176 | ::= | | | | | | 177 | ::= (var ...) 178 | ::= (block ...) 179 | ::= x | (x e) 180 | ::= (while ...) 181 | ::= (do-while ...) 182 | ::= (sif ) 183 | ::= (break) | (break label) 184 | 185 | ::= ... 186 | 187 | ::= | | | 188 | | | | | | 189 | ::= (if ) 190 | ::= x 191 | ::= ( ...) 192 | ::= (begin ...) 193 | ::= (:= x ) 194 | ::= (let ((x ) ...) ... ) 195 | ::= (lambda ( ...) ) 196 | 197 | ::= define | begin | urmodule | if | := | ...se code... 198 | 199 | ::= | | #t | #f 200 | 201 | an identifier that is not a keyword 202 | an integer between -2^53 and 2^53 203 | a symbol or string 204 | ```` 205 | 206 | # NOTES 207 | 208 | Some application are special cases: 209 | 210 | (ref e0 e1) becomes e0[e1] 211 | (ref e0 "str") becomes e0.str 212 | (array e ...) becomes [e,...] 213 | 214 | Property access with dot notation is rewritten to use bracket syntax in the parser. 215 | 216 | Example: `object.property` becomes `object["property"]` 217 | 218 | 219 | # SEMANTICS 220 | 221 | ### `(if e0 e1 e2)` 222 | If `e0` evaluates to value strictly equal to false, then `e2` otherwise `e1`. 223 | Note: The JavaScript becomes `((e0===false) ? e2 : e1)` 224 | 225 | ### `(var x (y 3))` 226 | Binds `x` to undefined and `y` to `3`. 227 | -------------------------------------------------------------------------------- /compiler-rjs/README.md: -------------------------------------------------------------------------------- 1 | Racket to JavaScript Compiler 2 | ============================= 3 | 4 | This collection contains a compiler that hopefully 5 | will evolve into a compiler that can compile Racket 6 | programs into JavaScript programs. 7 | 8 | The real Racket runtime is *huge* so it is is doubtful, 9 | that all corners of Racket will be covered. However 10 | I hope to the compiler eventually will be able to 11 | compile a large subset of all Racket programs. 12 | 13 | The status so far: 14 | 15 | - no continuation marks 16 | - no exceptions 17 | 18 | The runtime library is in "runtime.rkt". 19 | See the complete list of support data structures 20 | and implemented functions in the source. 21 | 22 | On JavaScript implementations that support (JavaScript) TCO the output 23 | of the compiler ought to handle (Racket) tail calls properly. 24 | 25 | /Jens Axel Søgaard 26 | -------------------------------------------------------------------------------- /compiler-rjs/htdp/colors.rkt: -------------------------------------------------------------------------------- 1 | #lang racket 2 | ; uncomment to test in Racket 3 | (struct color (red green blue [alpha #:auto]) 4 | #:auto-value 255 #:transparent) 5 | 6 | (define (color->web-color color) 7 | (string-append "rgba(" 8 | (color-red color) "," 9 | (color-green color) "," 10 | (color-blue color) "," 11 | (color-alpha color) ")")) 12 | 13 | (define (string->web-color str) 14 | (color->web-color (string->color str))) 15 | 16 | (define string->color 17 | (let () 18 | (define *color-table* (make-hasheq)) 19 | (define colors 20 | ; TODO: This is the short list. 21 | ; The full list is below. 22 | '(["orange" (255 165 0)] 23 | ["darkred" (139 0 0)] 24 | ["red" (255 0 0)] 25 | ["lightpink" (255 182 193)] 26 | ["pink" (255 192 203)] 27 | ["brown" (132 60 36)] 28 | ["gold" (255 215 0)] 29 | ["yellow" (255 255 0)] 30 | ["olive" (128 128 0)] 31 | ["green" ( 0 255 0)] 32 | ["dark green" ( 0 100 0)] 33 | ["darkgreen" ( 0 100 0)] 34 | ["aquamarine" (112 216 144)] 35 | ["lightgreen" (144 238 144)] 36 | ["turquoise" ( 64 224 208)] 37 | ["royalblue" ( 65 105 225)] 38 | ["cyan" ( 0 255 255)] 39 | ["aqua" ( 0 255 255)] 40 | ["darkcyan" ( 0 139 139)] 41 | ["teal" ( 0 128 128)] 42 | ["sky blue" (135 206 235)] 43 | ["skyblue" (135 206 235)] 44 | ["light blue" (173 216 230)] 45 | ["lightblue" (173 216 230)] 46 | ["lightcyan" (224 255 255)] 47 | ["medium blue" ( 0 0 205)] 48 | ["mediumblue" ( 0 0 205)] 49 | ["darkblue" ( 0 0 139)] 50 | ["midnight blue" ( 25 25 112)] 51 | ["midnightblue" ( 25 25 112)] 52 | ["navy" ( 36 36 140)] 53 | ["blue" ( 0 0 255)] 54 | ["indigo" ( 75 0 130)] 55 | ["purple" (160 32 240)] 56 | ["darkviolet" (148 0 211)] 57 | ["mediumpurple" (147 112 219)] 58 | ["magenta" (255 0 255)] 59 | ["darkmagenta" (139 0 139)] 60 | ["violet" (238 130 238)] 61 | ["lavender" (230 230 250)] 62 | ["white" (255 255 255)] 63 | ["light gray" (211 211 211)] 64 | ["lightgray" (211 211 211)] 65 | ["silver" (192 192 192)] 66 | ["gray" (190 190 190)] 67 | ["dark gray" (169 169 169)] 68 | ["darkgray" (169 169 169)] 69 | ["black" ( 0 0 0)]) 70 | #;'(["orange" (255 165 0)] 71 | ["orangered" (255 69 0)] 72 | ["tomato" (255 99 71)] 73 | ["darkred" (139 0 0)] 74 | ["red" (255 0 0)] 75 | ["firebrick" (178 34 34)] 76 | ["crimson" (220 20 60)] 77 | ["deeppink" (255 20 147)] 78 | ["maroon" (176 48 96)] 79 | ["indian red" (205 92 92)] 80 | ["indianred" (205 92 92)] 81 | ["medium violet red" (199 21 133)] 82 | ["mediumvioletred" (199 21 133)] 83 | ["violet red" (208 32 144)] 84 | ["violetred" (208 32 144)] 85 | ["lightcoral" (240 128 128)] 86 | ["hotpink" (255 105 180)] 87 | ["palevioletred" (219 112 147)] 88 | ["lightpink" (255 182 193)] 89 | ["rosybrown" (188 143 143)] 90 | ["pink" (255 192 203)] 91 | ["orchid" (218 112 214)] 92 | ["lavenderblush" (255 240 245)] 93 | ["snow" (255 250 250)] 94 | ["chocolate" (210 105 30)] 95 | ["saddlebrown" (139 69 19)] 96 | ["brown" (132 60 36)] 97 | ["darkorange" (255 140 0)] 98 | ["coral" (255 127 80)] 99 | ["sienna" (160 82 45)] 100 | ["salmon" (250 128 114)] 101 | ["peru" (205 133 63)] 102 | ["darkgoldenrod" (184 134 11)] 103 | ["goldenrod" (218 165 32)] 104 | ["sandybrown" (244 164 96)] 105 | ["lightsalmon" (255 160 122)] 106 | ["darksalmon" (233 150 122)] 107 | ["gold" (255 215 0)] 108 | ["yellow" (255 255 0)] 109 | ["olive" (128 128 0)] 110 | ["burlywood" (222 184 135)] 111 | ["tan" (210 180 140)] 112 | ["navajowhite" (255 222 173)] 113 | ["peachpuff" (255 218 185)] 114 | ["khaki" (240 230 140)] 115 | ["darkkhaki" (189 183 107)] 116 | ["moccasin" (255 228 181)] 117 | ["wheat" (245 222 179)] 118 | ["bisque" (255 228 196)] 119 | ["palegoldenrod" (238 232 170)] 120 | ["blanchedalmond" (255 235 205)] 121 | ["medium goldenrod" (234 234 173)] 122 | ["mediumgoldenrod" (234 234 173)] 123 | ["papayawhip" (255 239 213)] 124 | ["mistyrose" (255 228 225)] 125 | ["lemonchiffon" (255 250 205)] 126 | ["antiquewhite" (250 235 215)] 127 | ["cornsilk" (255 248 220)] 128 | ["lightgoldenrodyellow" (250 250 210)] 129 | ["oldlace" (253 245 230)] 130 | ["linen" (250 240 230)] 131 | ["lightyellow" (255 255 224)] 132 | ["seashell" (255 245 238)] 133 | ["beige" (245 245 220)] 134 | ["floralwhite" (255 250 240)] 135 | ["ivory" (255 255 240)] 136 | ["green" ( 0 255 0)] 137 | ["lawngreen" (124 252 0)] 138 | ["chartreuse" (127 255 0)] 139 | ["green yellow" (173 255 47)] 140 | ["greenyellow" (173 255 47)] 141 | ["yellow green" (154 205 50)] 142 | ["yellowgreen" (154 205 50)] 143 | ["medium forest green" (107 142 35)] 144 | ["olivedrab" (107 142 35)] 145 | ["mediumforestgreen" (107 142 35)] 146 | ["dark olive green" ( 85 107 47)] 147 | ["darkolivegreen" ( 85 107 47)] 148 | ["darkseagreen" (143 188 139)] 149 | ["lime" ( 0 255 0)] 150 | ["dark green" ( 0 100 0)] 151 | ["darkgreen" ( 0 100 0)] 152 | ["lime green" ( 50 205 50)] 153 | ["limegreen" ( 50 205 50)] 154 | ["forest green" ( 34 139 34)] 155 | ["forestgreen" ( 34 139 34)] 156 | ["spring green" ( 0 255 127)] 157 | ["springgreen" ( 0 255 127)] 158 | ["medium spring green" ( 0 250 154)] 159 | ["mediumspringgreen" ( 0 250 154)] 160 | ["sea green" ( 46 139 87)] 161 | ["seagreen" ( 46 139 87)] 162 | ["medium sea green" ( 60 179 113)] 163 | ["mediumseagreen" ( 60 179 113)] 164 | ["aquamarine" (112 216 144)] 165 | ["lightgreen" (144 238 144)] 166 | ["pale green" (152 251 152)] 167 | ["palegreen" (152 251 152)] 168 | ["medium aquamarine" (102 205 170)] 169 | ["mediumaquamarine" (102 205 170)] 170 | ["turquoise" ( 64 224 208)] 171 | ["lightseagreen" ( 32 178 170)] 172 | ["medium turquoise" ( 72 209 204)] 173 | ["mediumturquoise" ( 72 209 204)] 174 | ["honeydew" (240 255 240)] 175 | ["mintcream" (245 255 250)] 176 | ["royalblue" ( 65 105 225)] 177 | ["dodgerblue" ( 30 144 255)] 178 | ["deepskyblue" ( 0 191 255)] 179 | ["cornflowerblue" (100 149 237)] 180 | ["steel blue" ( 70 130 180)] 181 | ["steelblue" ( 70 130 180)] 182 | ["lightskyblue" (135 206 250)] 183 | ["dark turquoise" ( 0 206 209)] 184 | ["darkturquoise" ( 0 206 209)] 185 | ["cyan" ( 0 255 255)] 186 | ["aqua" ( 0 255 255)] 187 | ["darkcyan" ( 0 139 139)] 188 | ["teal" ( 0 128 128)] 189 | ["sky blue" (135 206 235)] 190 | ["skyblue" (135 206 235)] 191 | ["cadet blue" ( 96 160 160)] 192 | ["cadetblue" ( 95 158 160)] 193 | ["dark slate gray" ( 47 79 79)] 194 | ["darkslategray" ( 47 79 79)] 195 | ["lightslategray" (119 136 153)] 196 | ["slategray" (112 128 144)] 197 | ["light steel blue" (176 196 222)] 198 | ["lightsteelblue" (176 196 222)] 199 | ["light blue" (173 216 230)] 200 | ["lightblue" (173 216 230)] 201 | ["powderblue" (176 224 230)] 202 | ["paleturquoise" (175 238 238)] 203 | ["lightcyan" (224 255 255)] 204 | ["aliceblue" (240 248 255)] 205 | ["azure" (240 255 255)] 206 | ["medium blue" ( 0 0 205)] 207 | ["mediumblue" ( 0 0 205)] 208 | ["darkblue" ( 0 0 139)] 209 | ["midnight blue" ( 25 25 112)] 210 | ["midnightblue" ( 25 25 112)] 211 | ["navy" ( 36 36 140)] 212 | ["blue" ( 0 0 255)] 213 | ["indigo" ( 75 0 130)] 214 | ["blue violet" (138 43 226)] 215 | ["blueviolet" (138 43 226)] 216 | ["medium slate blue" (123 104 238)] 217 | ["mediumslateblue" (123 104 238)] 218 | ["slate blue" (106 90 205)] 219 | ["slateblue" (106 90 205)] 220 | ["purple" (160 32 240)] 221 | ["dark slate blue" ( 72 61 139)] 222 | ["darkslateblue" ( 72 61 139)] 223 | ["darkviolet" (148 0 211)] 224 | ["dark orchid" (153 50 204)] 225 | ["darkorchid" (153 50 204)] 226 | ["mediumpurple" (147 112 219)] 227 | ["cornflower blue" ( 68 64 108)] 228 | ["medium orchid" (186 85 211)] 229 | ["mediumorchid" (186 85 211)] 230 | ["magenta" (255 0 255)] 231 | ["fuchsia" (255 0 255)] 232 | ["darkmagenta" (139 0 139)] 233 | ["violet" (238 130 238)] 234 | ["plum" (221 160 221)] 235 | ["lavender" (230 230 250)] 236 | ["thistle" (216 191 216)] 237 | ["ghostwhite" (248 248 255)] 238 | ["white" (255 255 255)] 239 | ["whitesmoke" (245 245 245)] 240 | ["gainsboro" (220 220 220)] 241 | ["light gray" (211 211 211)] 242 | ["lightgray" (211 211 211)] 243 | ["silver" (192 192 192)] 244 | ["gray" (190 190 190)] 245 | ["dark gray" (169 169 169)] 246 | ["darkgray" (169 169 169)] 247 | ["dim gray" (105 105 105)] 248 | ["dimgray" (105 105 105)] 249 | ["black" ( 0 0 0)])) 250 | (for ([x (in-list colors)]) 251 | (define name (first x)) 252 | (define rgb (second x)) 253 | (define-values (r g b) (values (first rgb) (second rgb) (third rgb))) 254 | (hash-set! *color-table* (string->symbol (first x)) (color r g b))) 255 | (λ (color-string) 256 | (hash-ref *color-table* (string->symbol (string-downcase color-string)))))) 257 | -------------------------------------------------------------------------------- /compiler-rjs/htdp/ffi.rkt: -------------------------------------------------------------------------------- 1 | ; Uncommment to test in Racket 2 | #lang racket/base 3 | (require (for-syntax racket/base)) 4 | 5 | (begin 6 | (define assoc->object values) 7 | (define (js-ref . xs) (cons 'js-ref xs)) 8 | (define (js-set! . xs) (cons 'js-set! xs)) 9 | (define (js-call . xs) (cons 'js-call xs)) 10 | (define (js-undefined) 'undefined)) 11 | 12 | ;;; Types 13 | (struct ffi-type (name check ex im)) 14 | 15 | ;;; Real 16 | (define (check-real x) (number? x)) 17 | (define (export-real x) x) 18 | (define (import-real x) x) 19 | (define Real (ffi-type "Real" check-real export-real import-real)) 20 | ;;; Boolean 21 | (define (check-boolean x) #t) 22 | (define (boolify x) (if x #t #f)) 23 | (define Boolean (ffi-type "Boolean" check-boolean boolify boolify)) 24 | ;;; String (accepts symbols too, but returns strings 25 | (define (check-string x) (or (string? x) (symbol? x))) 26 | (define (export-string x) (if (string? x) (string->immutable-string x) (symbol->string x))) 27 | (define (import-string x) x) 28 | (define String (ffi-type "String" check-string export-string import-string)) 29 | ;;; Number01 (a number between 0 and 1) 30 | (define (check-number01 x) (and (number? x) (<= 0 x) (<= x 1))) 31 | (define (export-number01 x) x) 32 | (define (import-number01 x) x) 33 | (define Number01 (ffi-type "Number01" check-number01 export-number01 import-number01)) 34 | ;;; Dict (an object with properties used as key-value pairs) 35 | (define (export-dict x) (if (list? x) (assoc->object x) x)) 36 | (define (import-dict x) (error 'import-dict "TODO") x) 37 | (define Dict (ffi-type "Dict" list? export-dict import-dict)) 38 | ;;; Void 39 | (define (always-true x) #t) 40 | (define Void (ffi-type "Void" always-true void void)) 41 | ;;; Do Nothing 42 | (define Any (ffi-type "Any" always-true #f #f)) 43 | (define CanvasPattern (ffi-type "CanvasPattern" always-true #f #f)) 44 | (define CanvasGradient (ffi-type "CanvasGradient" always-true #f #f)) 45 | (define LineDashArray (ffi-type "LineDashArray" always-true #f #f)) 46 | (define TextMetrics (ffi-type "TextMetrics" always-true #f #f)) 47 | (define Path2D (ffi-type "Path2D" always-true #f #f)) 48 | (define ImageData (ffi-type "ImageData" always-true #f #f)) 49 | (define Element (ffi-type "Element" always-true #f #f)) 50 | (define Segments (ffi-type "Segments" always-true #f #f)) 51 | (define Image (ffi-type "Image" always-true #f #f)) 52 | ; An Image can be one of these: 53 | ; HTMLImageElement (), 54 | ; HTMLVideoElement (