This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// by Dmitry Soshnikov <[email protected]> | |
// MIT Style License | |
*Classification of classes:* | |
============================================================================= | |
| Dynamic | Static | |
----------------------------------------------------------------------------- | |
| | | |
| Coffee, Python, Ruby, | SmallTalk, built-in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Manual negative indicies for arrays in ES5: | |
* usually we use in such cases only first three | |
* negative indices, so these are enough (you may | |
* add -4, -5, etc. if needed). | |
* | |
* See also the implementation with proxies: | |
* https://github.com/DmitrySoshnikov/es-laboratory/blob/master/src/array-negative-indices.js | |
* | |
* by Dmitry Soshnikov <[email protected]> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Process</title> | |
<style type="text/css"> | |
#p-0 {color: green;} | |
#p-1 {color: blue;} | |
.p { | |
float: left; | |
width: 300px; | |
border: 1px solid #CCC; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The simplest processes (cooperative tasks) with Scheduler | |
* (sort of Erlang's processes but without messages yet) | |
* See also: http://www.dabeaz.com/coroutines/index.html | |
* | |
* Deps: JS 1.7 with generators (yield) | |
* | |
* by Dmitry Soshnikov <[email protected]> | |
* MIT Style License | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The simplest processes (cooperative tasks) with Scheduler | |
* (sort of Erlang's processes but without messages yet) | |
* See: http://www.dabeaz.com/coroutines/index.html | |
* | |
* Deps: JS 1.7 with generators (yield) | |
* | |
* This version uses "trampolining" technique to request | |
* data from other processes in synchronous manner. | |
* See also: https://gist.github.com/1127536 (without "trampolining") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Features of bound functions. | |
* | |
* See: http://dmitrysoshnikov.com/notes/note-1-ecmascript-bound-functions/ | |
* | |
* by Dmitry Soshnikov <[email protected]> | |
* MIT Style License | |
*/ | |
var F = function () {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Simple doc-property generator. Uses JavaDoc style comments. | |
* Also provides type checking guards. | |
* | |
* Dependencies: SpiderMonkey >= 1.7 | |
* | |
* by Dmitry Soshnikov <[email protected]> | |
* MIT Style License | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Postfix notation math evaluator | |
* See: http://en.wikipedia.org/wiki/Reverse_Polish_notation | |
* | |
* See also prefix notation example: | |
* https://github.com/DmitrySoshnikov/Essentials-of-interpretation/blob/master/src/notes/note-1.js | |
* | |
* by Dmitry Soshnikov <[email protected]> | |
* MIT Style License | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Shunting yard algorithm | |
* See: http://en.wikipedia.org/wiki/Shunting_yard_algorithm | |
* | |
* Converts infix notation to postfix notation | |
* | |
* by Dmitry Soshnikov <[email protected]> | |
* MIT Style License | |
* | |
* (C) 2011, updated on 2020 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Infix to postfix notation RegExp converter | |
* | |
* To implement RegExp machine (NFA, DFA) we need | |
* to transform first RegExp string to postfix notation | |
* for more convinient work with the stack. This function | |
* does exactly this. | |
* | |
* See: http://swtch.com/~rsc/regexp/regexp1.html | |
* |