https://github.com/featurist/language
DSLs for the washed masses
https://github.com/featurist/language
Last synced: about 2 months ago
JSON representation
DSLs for the washed masses
- Host: GitHub
- URL: https://github.com/featurist/language
- Owner: featurist
- Created: 2014-04-26T18:32:28.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2014-05-05T17:00:24.000Z (almost 11 years ago)
- Last Synced: 2025-02-21T01:46:10.107Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 164 KB
- Stars: 2
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Language
`language` is a very small library for building DSLs in Javascript.
npm install language
# Why?
Because magic scope! and because no globals!
var language = require('language');
var robot = language({
position: {x: 0, y: 0},moveLeft: function() {
this.position.x--;
},moveRight: function() {
this.position.x++;
},moveUp: function() {
this.position.y--;
},moveDown: function() {
this.position.y++;
},
});robot(function () {
console.log(position);moveDown();
console.log(position);moveRight();
console.log(position);
});# How?
Read the [source](https://github.com/featurist/language/blob/master/index.js), it's small.