@@ -91,11 +91,12 @@ Further documentation in [`doc/`][25]:
91
91
- [ Module packaging and distribution tutorial] [ 28 ]
92
92
- [ Comparison against other JS-lisps] [ 29 ]
93
93
- [ Using source maps] [ 30 ]
94
+ - [ Using with client-side bundling tools] [ 31 ]
94
95
95
96
## Brief tutorial
96
97
97
- This is a quick overview of the core language. See [ the basics reference] [ 31 ]
98
- or the [ test suite] [ 32 ] for a more complete document.
98
+ This is a quick overview of the core language. See [ the basics reference] [ 32 ]
99
+ or the [ test suite] [ 33 ] for a more complete document.
99
100
100
101
### Building blocks
101
102
@@ -145,7 +146,7 @@ arguments as the rest:
145
146
a.b[5].c['yo'];
146
147
1 + 2;
147
148
148
- If the ` (. a b) ` syntax feels tedious, you might like the [ eslisp-propertify] [ 33 ] transform macro, which lets you write ` a.b ` instead.
149
+ If the ` (. a b) ` syntax feels tedious, you might like the [ eslisp-propertify] [ 34 ] transform macro, which lets you write ` a.b ` instead.
149
150
150
151
If the first element of a list isn't the name of a macro which is in scope, it
151
152
compiles to a function call:
@@ -265,7 +266,7 @@ Macros are functions that run at compile-time. Whatever they return becomes
265
266
part of the compiled code. User-defined macros and pre-defined compiler ones
266
267
are treated equivalently.
267
268
268
- ** There's a [ fuller tutorial to eslisp macros in the ` doc/ ` directory] [ 34 ] .**
269
+ ** There's a [ fuller tutorial to eslisp macros in the ` doc/ ` directory] [ 35 ] .**
269
270
These are just some highlights.
270
271
271
272
You can alias macros to names you find convenient, or mask any you don't want
@@ -286,7 +287,7 @@ to use.
286
287
[1];
287
288
array(1);
288
289
289
- Macros can use [ ` quasiquote ` ] [ 35 ] (`` ` `` ), ` unquote ` (` , ` ) and
290
+ Macros can use [ ` quasiquote ` ] [ 36 ] (`` ` `` ), ` unquote ` (` , ` ) and
290
291
` unquote-splicing ` (` ,@ ` ) to construct their outputs neatly.
291
292
292
293
<!-- !test in macro and call -->
@@ -348,7 +349,7 @@ compilation side-effects and conditional compilation.
348
349
349
350
Because macros are JS functions and JS functions can be closures, you can even
350
351
make macros that share state. One way is to put them in an
351
- [ immediately-invoked function expression (IIFE)] [ 36 ] , return them in an object,
352
+ [ immediately-invoked function expression (IIFE)] [ 37 ] , return them in an object,
352
353
and pass that to ` macro ` . Each property of the object is imported as a macro,
353
354
and the variables in the IIFE are shared between them.
354
355
@@ -386,9 +387,9 @@ whatever, so you can put the macro function in a separate file and do—
386
387
387
388
—to use it.
388
389
389
- This means you can publish eslisp macros on [ npm] [ 37 ] . The name prefix
390
+ This means you can publish eslisp macros on [ npm] [ 38 ] . The name prefix
390
391
` eslisp- ` and keyword ` eslisp-macro ` are recommended. [ Some exist
391
- already.] [ 38 ]
392
+ already.] [ 39 ]
392
393
393
394
### Transformation macros
394
395
@@ -398,18 +399,18 @@ argument (`-t` for short). For example,
398
399
399
400
eslc --transform eslisp-propertify myprogram.esl
400
401
401
- uses [ eslisp-propertify] [ 39 ] to convert all atoms containg dots into member
402
+ uses [ eslisp-propertify] [ 40 ] to convert all atoms containg dots into member
402
403
expressions. The flag can be specified multiple times.
403
404
404
405
## Try it
405
406
406
407
### Global install
407
408
408
- If you want ` eslc ` in your [ ` $PATH ` ] [ 40 ] , ` npm install --global eslisp ` . (You
409
+ If you want ` eslc ` in your [ ` $PATH ` ] [ 41 ] , ` npm install --global eslisp ` . (You
409
410
might need ` sudo ` .) Then ` eslc ` program takes eslisp code as input and outputs
410
411
JavaScript.
411
412
412
- The compiler runs as a [ REPL] [ 41 ] if given no arguments, though it doesn't
413
+ The compiler runs as a [ REPL] [ 42 ] if given no arguments, though it doesn't
413
414
(yet) support macros in that mode.
414
415
415
416
You can also just pipe data to it to compile it if you want.
@@ -431,21 +432,21 @@ it sees them.
431
432
## How does it work
432
433
433
434
In brief: A table of predefined macros is used to turn S-expressions into
434
- [ SpiderMonkey AST] [ 42 ] , which is fed to [ escodegen] [ 43 ] , which outputs JS.
435
+ [ SpiderMonkey AST] [ 43 ] , which is fed to [ escodegen] [ 44 ] , which outputs JS.
435
436
Some of those macros allow defining further macros, which get added to the
436
437
table and work from then on like the predefined ones.
437
438
438
- For more, read [ the source] [ 44 ] . Ask questions!
439
+ For more, read [ the source] [ 45 ] . Ask questions!
439
440
440
441
## Bugs, discussion & contributing
441
442
442
- Create a [ github issue] [ 45 ] , or say hi [ in gitter chat] [ 46 ] .
443
+ Create a [ github issue] [ 46 ] , or say hi [ in gitter chat] [ 47 ] .
443
444
444
- I'll assume your contributions to also be under the [ ISC license] [ 47 ] .
445
+ I'll assume your contributions to also be under the [ ISC license] [ 48 ] .
445
446
446
447
## License
447
448
448
- [ ISC] [ 48 ] .
449
+ [ ISC] [ 49 ] .
449
450
450
451
[ 1 ] : https://www.npmjs.com/package/eslisp
451
452
[ 2 ] : https://travis-ci.org/anko/eslisp
@@ -477,21 +478,22 @@ I'll assume your contributions to also be under the [ISC license][47].
477
478
[ 28 ] : doc/ditributing-modules.markdown
478
479
[ 29 ] : doc/comparison-to-other-js-lisps.markdown
479
480
[ 30 ] : doc/source-maps.markdown
480
- [ 31 ] : doc/basics-reference .markdown
481
- [ 32 ] : test.ls
482
- [ 33 ] : https://www.npmjs.com/package/eslisp-propertify
483
- [ 34 ] : doc/how-macros-work.markdown
484
- [ 35 ] : http://axisofeval.blogspot.co.uk/2013/04/a-quasiquote-i-can-understand.html
485
- [ 36 ] : https ://en.wikipedia.org/wiki/Immediately-invoked_function_expression
486
- [ 37 ] : https://www.npmjs.com/
487
- [ 38 ] : https://www.npmjs.com/search?q=eslisp-
488
- [ 39 ] : https://www.npmjs.com/package/ eslisp-propertify
489
- [ 40 ] : http ://en.wikipedia.org/wiki/PATH_(variable)
490
- [ 41 ] : https ://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop
491
- [ 42 ] : https://developer.mozilla .org/en-US/docs/Mozilla/Projects/SpiderMonkey/Parser_API
492
- [ 43 ] : https://github.com/estools/escodegen
493
- [ 44 ] : src/
494
- [ 45 ] : https://github.com/anko/eslisp/issues/new
495
- [ 46 ] : https://gitter.im /anko/eslisp
496
- [ 47 ] : http ://opensource.org/licenses/ISC
481
+ [ 31 ] : doc/bundling .markdown
482
+ [ 32 ] : doc/basics-reference.markdown
483
+ [ 33 ] : test.ls
484
+ [ 34 ] : https://www.npmjs.com/package/eslisp-propertify
485
+ [ 35 ] : doc/how-macros-work.markdown
486
+ [ 36 ] : http ://axisofeval.blogspot.co.uk/2013/04/a-quasiquote-i-can-understand.html
487
+ [ 37 ] : https://en.wikipedia.org/wiki/Immediately-invoked_function_expression
488
+ [ 38 ] : https://www.npmjs.com/
489
+ [ 39 ] : https://www.npmjs.com/search?q= eslisp-
490
+ [ 40 ] : https ://www.npmjs.com/package/eslisp-propertify
491
+ [ 41 ] : http ://en.wikipedia.org/wiki/PATH_(variable)
492
+ [ 42 ] : https://en.wikipedia .org/wiki/Read%E2%80%93eval%E2%80%93print_loop
493
+ [ 43 ] : https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Parser_API
494
+ [ 44 ] : https://github.com/estools/escodegen
495
+ [ 45 ] : src/
496
+ [ 46 ] : https://github.com /anko/eslisp/issues/new
497
+ [ 47 ] : https ://gitter.im/anko/eslisp
497
498
[ 48 ] : http://opensource.org/licenses/ISC
499
+ [ 49 ] : http://opensource.org/licenses/ISC
0 commit comments