In this tutorial we're going to build a set of parser combinators.
We'll answer the above question in 2 steps.
- What is a parser?
- and, what is a parser combinator?
So first question: What is parser?
| // Creates a new promise that automatically resolves after some timeout: | |
| Promise.delay = function (time) { | |
| return new Promise((resolve, reject) => { | |
| setTimeout(resolve, time) | |
| }) | |
| } | |
| // Throttle this promise to resolve no faster than the specified time: | |
| Promise.prototype.takeAtLeast = function (time) { | |
| return new Promise((resolve, reject) => { |
Convert a flat representation of a hierarchical data into a nested tree structure.
| language: java | |
| sudo: required | |
| jdk: | |
| - oraclejdk8 | |
| cache: | |
| directories: | |
| - $HOME/.CommandBox | |
| env: | |
| matrix: | |
| - [email protected] |
| var elixir = require('laravel-elixir'); | |
| var gutil = require('gulp-util'); | |
| // If 'gulp watch' is run | |
| if (gutil.env._.indexOf('watch') > -1) { | |
| // Enable watchify for faster builds | |
| elixir.config.js.browserify.watchify.enabled = true |
| component { | |
| this.name = 'TestBoxTestingSuite' & hash(getCurrentTemplatePath()); | |
| this.sessionManagement = true; | |
| this.sessionTimeout = createTimeSpan(0, 0, 15, 0); | |
| this.applicationTimeout = createTimeSpan(0, 0, 15, 0); | |
| this.setClientCookies = true; | |
| this.mappings['/tests'] = getDirectoryFromPath(getCurrentTemplatePath()); | |
| rootPath = REReplaceNoCase(this.mappings['/tests'], 'tests(\\|/)', ''); |
| function Box(x,y) { | |
| this.x = x; | |
| this.y = y; | |
| } | |
| var Box1 = Singleton(Box, { argumentCheck: 'equal'}); | |
| var Box2 = Singleton(Box, { argumentCheck: 'equal'}); | |
| var obj1 = new Box1(1,2); | |
| var obj2 = new Box2(1,2); |
| . | |
| ├── actions | |
| ├── stores | |
| ├── views | |
| │ ├── Anonymous | |
| │ │ ├── __tests__ | |
| │ │ ├── views | |
| │ │ │ ├── Home | |
| │ │ │ │ ├── __tests__ | |
| │ │ │ │ └── Handler.js |
#Roost Chicago 2014 Q&A
the problem with using requires inline rather than declaring dependencies that a race condition for loading may happen. define() and require() are slightly different
in app code, it's really a matter of style. listing deps in an array is the AMD format, using require is the CommonJS style. A script loader has to parse the CommonJS format to build up the AMD-style array before it runs, but otherwise they behave the same