{"_id":"ham","_rev":"15-a7aeee7f9a417ad50a5d5b7d057582af","name":"ham","description":"A Hammier Javascript","dist-tags":{"latest":"0.1.1"},"versions":{"0.0.5":{"name":"ham","version":"0.0.5","description":"A Hammier Javascript","scripts":{"test":"echo \"Error: no test specified\" && exit 1","postinstall":"./node_modules/canopy/bin/canopy ./src/lang.peg"},"repository":{"type":"git","url":"https://github.com/jameskeane/ham-script.git"},"main":"src/ham.js","bin":{"ham":"src/main.js"},"keywords":["ham","peg","javascript"],"author":{"name":"James Keane"},"license":"BSD","dependencies":{"canopy":"0.2.0","underscore":"~1.4.3","optimist":"0.3.5"},"readme":"Ham -- an altJS language\n=========================\nHam is another altJS language, similar to [CoffeeScript](http://coffeescript.org/).  What makes Ham different is that it is written as a PEG,\nand does not have significant whitespace.  Ham looks very similar to Javascript at first, but offers (hopefully)\nmany useful features.\n\nHam was written using the [Canopy](http://canopy.jcoglan.com/) PEG Parser Generator, and Javascript.  I am\ncurrently working towards self-hosting Ham but it is not quite there yet.\n\nHam is written in an MVC style manner, where model is the AST, view is the javascript translations \n(using ejs templates), and the controller is the tree translators.  This makes Ham extremely easy to hack on, and fun!\n\nSyntax\n------\nSince Ham is extremely similar to Javascript, you can get almost perfect syntax hilighting for free by using the Javascript\nhilighters, which is a pretty neat side effect.\n\n### Array Ranges and Slices\nHam supports [python style](http://stackoverflow.com/a/509295) list ranges and slicing.\n\n```Javascript\nvar range = [1..5];\n\nrange === [1, 2, 3, 4, 5];    // true\nrange[1:] === [2, 3, 4, 5];   // true\nrange[:4] === [1, 2, 3, 4];   // true\nrange[::2] === [1, 3, 5];     // true\n```\n\n### List Comprehensions\nHam supports list comprehensions, similar in style to Haskell.\n```Javascript\nvar cross = [x*y | x <- range, y <- range[::-1]];\n```\n\n### Friendly Lambda's\nHam makes it fun to use lambda's.\n```Javascript\nvar sum = |x, y| { return x + y; }\n\n// If the body of the lambda is a single expression, \n// then the `return` statement and semicolon can be dropped.\nvar sum = |x, y| { x + y }\n\n// Lambda's are an easy way to iterate a list:\n[1, 2, 3].each(|| { console.log('repeating'); });\n\n// If the lambda takes no parameters, the `||` can be dropped.\n[1, 2, 3].each({ console.log('repeating');});\n\n// When invoking a function with a lambda as the _only_ parameter, the parentheses can be dropped\n[1, 2, 3].each {\n   console.log('repeating');\n};\n```\n\n### Classical Style Inheritence\nSome people would prefer to use Classical Inheritence instead of Javascript's prototypical inheritence, that's fine:\n```Javascript\nclass Hamburger extends MeatMeal {\n   eat: { console.log('om nom nom'); }\n};\n\n// Ham just uses Backbone style .extend() for inheritence, so this translates easily to:\n// var Hamburger = MeatMeal.extend({ ... });\n```\n\n### Prototype shortcut\nStolen from Coffeescript, is the prototype shortcut:\n```Javascript\nString::startsWith = |str| { this.substr(0, str.length) === str };\n```\n\nWhat else is comming?\n---------------------\n\n### Types\nWould be nice to have some inference at compile time, with contracts at runtime for what couldn't be inferred.\n```Javascript\nvar x:string = 3; // TypeError -> typeof \"x\" is string.\nvar sum = |x:num, y:num| { x + y }; // we could infer the return type easily here\nvar idk = ||:string { \"hello\" }; // I'm not sold on the return type syntax here\n```\n\n### Imports\nI like python style imports, but I think it might be hard/impossible to reconcile it with CommonJS style require.\nAnother option is to rewrite a CommonJS style require for the browser, similar to \n[browserify](https://github.com/substack/node-browserify).\n```Javascript\nimport Backbone, _ from 'vendor/backbone'; // would work great for browser, but hard for CommonJS\n```\n\n### Decorators\nI also sometimes find myself with a need for python style Decorators, so Ham will have some form of them.\n```Javascript\n@watch(notify_change)\nvar the_ghost_man = 3;\n```\n\n### Unary Operators\nYeah, I haven't gotten around to unary operators yet.  I've been focussing on the cool stuff for now.\n\n### Loops\nI haven't implemented while or for loops yet, as I am still experimenting with syntax for them.  I've been getting by\nlargely with the combination of ranges and list comprehensions with `.each`.\n\nUsage\n-----\n`npm install -g ham`\nThen write some Ham.js code, and `ham <filename>` to run it.","readmeFilename":"README.md","_id":"ham@0.0.5","dist":{"shasum":"7728c81392907c8d935f7b5a708c4668af10d159","tarball":"https://registry.npmjs.org/ham/-/ham-0.0.5.tgz","integrity":"sha512-fFJNmTor+Jv60+PkRXjwt+IsNVL+57PGYK2zj4owOpatK26e0bB8ohrbncaiPHmoPztZS4Pl7Zy39z/2L4d4fg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF69CGgss8s02MNmmEXoQEdVgFLo2sOminmMEqnHke9+AiEAlBeM94xVusyUu/AG+BAzvKpX1B5qHoJHBPdRteMOsq8="}]},"_npmVersion":"1.1.66","_npmUser":{"name":"jameskeane","email":"james.keane@gmail.com"},"maintainers":[{"name":"jameskeane","email":"james.keane@gmail.com"}]},"0.0.7":{"name":"ham","version":"0.0.7","description":"A Hammier Javascript","scripts":{"test":"echo \"Error: no test specified\" && exit 1","postinstall":"./node_modules/canopy/bin/canopy ./src/lang.peg"},"repository":{"type":"git","url":"https://github.com/jameskeane/ham-script.git"},"main":"src/ham.js","bin":{"ham":"src/main.js"},"keywords":["ham","peg","javascript"],"author":{"name":"James Keane"},"license":"BSD","dependencies":{"canopy":"0.2.0","underscore":"~1.4.3","optimist":"0.3.5","source-map":"0.1.8"},"readme":"Ham -- an altJS language\n=========================\nHam is another altJS language, similar to [CoffeeScript](http://coffeescript.org/).  What makes Ham different is that it is written as a PEG,\nand does not have significant whitespace.  Ham looks very similar to Javascript at first, but offers (hopefully)\nmany useful features.\n\nHam was written using the [Canopy](http://canopy.jcoglan.com/) PEG Parser Generator, and Javascript.  I am\ncurrently working towards self-hosting Ham but it is not quite there yet.\n\nHam is written in an MVC style manner, where model is the AST, view is the javascript translations \n(using ejs templates), and the controller is the tree translators.  This makes Ham extremely easy to hack on, and fun!\n\nSyntax\n------\nSince Ham is extremely similar to Javascript, you can get almost perfect syntax hilighting for free by using the Javascript\nhilighters, which is a pretty neat side effect.\n\n### Array Ranges and Slices\nHam supports [python style](http://stackoverflow.com/a/509295) list ranges and slicing.\n\n```Javascript\nvar range = [1..5];\n\nrange === [1, 2, 3, 4, 5];    // true\nrange[1:] === [2, 3, 4, 5];   // true\nrange[:4] === [1, 2, 3, 4];   // true\nrange[::2] === [1, 3, 5];     // true\n```\n\n### List Comprehensions\nHam supports list comprehensions, similar in style to Haskell.\n```Javascript\nvar cross = [x*y | x <- range, y <- range[::-1]];\n```\n\n### Friendly Lambda's\nHam makes it fun to use lambda's.\n```Javascript\nvar sum = |x, y| { return x + y; }\n\n// If the body of the lambda is a single expression, \n// then the `return` statement and semicolon can be dropped.\nvar sum = |x, y| { x + y }\n\n// Lambda's are an easy way to iterate a list:\n[1, 2, 3].each(|| { console.log('repeating'); });\n\n// If the lambda takes no parameters, the `||` can be dropped.\n[1, 2, 3].each({ console.log('repeating');});\n\n// When invoking a function with a lambda as the _only_ parameter, the parentheses can be dropped\n[1, 2, 3].each {\n   console.log('repeating');\n};\n```\n\n### Classical Style Inheritence\nSome people would prefer to use Classical Inheritence instead of Javascript's prototypical inheritence, that's fine:\n```Javascript\nclass Hamburger extends MeatMeal {\n   eat: { console.log('om nom nom'); }\n};\n\n// Ham just uses Backbone style .extend() for inheritence, so this translates easily to:\n// var Hamburger = MeatMeal.extend({ ... });\n```\n\n### Operator overloading\nBeing able to overload the default behaviour of javascript operators is sometimes useful:\n```Javascript\nclass Vector {\n  x:0, y:0, z:0,\n  constructor: |x, y, z| { this.x=x; this.y=y; this.z=z; },\n  operator+: |other| { new Vector(this.x+other.x, this.y+other.y, this.z+other.z) }\n};\n\nvar v1 = new Vector(1, 2, 3);\nvar v2 = new Vector(1, 2, 3);\n\nconsole.log(v1 + v2); // === {x: 2, y: 4, z: 6}\n```\n\n### Prototype shortcut\nStolen from Coffeescript, is the prototype shortcut:\n```Javascript\nString::startsWith = |str| { this.substr(0, str.length) === str };\n```\n\n### Numbers as objects\nHam wraps numbers in the javascript built-in Number Object and extends it's prototype with nice things:\n```Javascript\n3.times {\n  console.log('hello world!'); \n};\n```\n\nWhat else is coming?\n---------------------\n\n### Types\nWould be nice to have some inference at compile time, with contracts at runtime for what couldn't be inferred.\n```Javascript\nvar x:string = 3; // TypeError -> typeof \"x\" is string.\nvar sum = |x:num, y:num| { x + y }; // we could infer the return type easily here\nvar idk = ||:string { \"hello\" }; // I'm not sold on the return type syntax here\n```\n\n### Imports\nI like python style imports, but I think it might be hard/impossible to reconcile it with CommonJS style require.\nAnother option is to rewrite a CommonJS style require for the browser, similar to \n[browserify](https://github.com/substack/node-browserify).\n```Javascript\nimport Backbone, _ from 'vendor/backbone'; // would work great for browser, but hard for CommonJS\n```\n\n### Decorators\nI also sometimes find myself with a need for python style Decorators, so Ham will have some form of them.\n```Javascript\n@watch(notify_change)\nvar the_ghost_man = 3;\n```\n\n### Unary Operators\nYeah, I haven't gotten around to unary operators yet.  I've been focussing on the cool stuff for now.\n\n### Loops\nI haven't implemented while or for loops yet, as I am still experimenting with syntax for them.  I've been getting by\nlargely with the combination of ranges and list comprehensions with `.each`.\n\nUsage\n-----\n`npm install -g ham`\nThen write some Ham.js code, and `ham <filename>` to run it.\n","readmeFilename":"README.md","_id":"ham@0.0.7","dist":{"shasum":"f45f8ae348f5c29a025d738dc612b26a917a2c26","tarball":"https://registry.npmjs.org/ham/-/ham-0.0.7.tgz","integrity":"sha512-4BXXq8VIvqL9KgBqdOy+uFPxxbv09HmFT/vjXQdyUCS8xdrIwrBPiuOLEs6sQpYr/pu2q9mg+KJmcgEvXdRb7g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGTnLsW4ZigjWIWCrW1Zld8rYi7jbL02q83y5udfllK0AiBk25OF4pHGXdKUgG5+upzaeXDR+ubm5GkU9Ep6+E8AIQ=="}]},"_npmVersion":"1.1.66","_npmUser":{"name":"jameskeane","email":"james.keane@gmail.com"},"maintainers":[{"name":"jameskeane","email":"james.keane@gmail.com"}]},"0.0.8":{"name":"ham","version":"0.0.8","description":"A Hammier Javascript","scripts":{"test":"cucumber.js","postinstall":"make"},"repository":{"type":"git","url":"https://github.com/jameskeane/ham-script.git"},"main":"src/ham.js","bin":{"ham":"src/main.js"},"keywords":["ham","peg","javascript"],"author":{"name":"James Keane"},"license":"BSD","devDependencies":{"cucumber":"0.3.0","browserify":"1.17.3"},"dependencies":{"canopy":"0.2.0","underscore":"~1.4.3","optimist":"0.3.5","source-map":"git://github.com/jameskeane/source-map.git"},"readme":"Ham -- an altJS language\n=========================\nHam is another altJS language, similar to [CoffeeScript](http://coffeescript.org/).  What makes Ham different is that it is written as a PEG,\nand does not have significant whitespace.  Ham looks very similar to Javascript at first, but offers (hopefully)\nmany useful features.\n\nHam was written using the [Canopy](http://canopy.jcoglan.com/) PEG Parser Generator, and Javascript.  I am\ncurrently working towards self-hosting Ham but it is not quite there yet.\n\nHam is written in an MVC style manner, where model is the AST, view is the javascript translations \n(using ejs templates), and the controller is the tree translators.  This makes Ham extremely easy to hack on, and fun!\n\nSyntax\n------\nSince Ham is extremely similar to Javascript, you can get almost perfect syntax hilighting for free by using the Javascript\nhilighters, which is a pretty neat side effect.\n\n### Array Ranges and Slices\nHam supports [python style](http://stackoverflow.com/a/509295) list ranges and slicing.\n\n```Javascript\nvar range = [1..5];\n\nrange === [1, 2, 3, 4, 5];    // true\nrange[1:] === [2, 3, 4, 5];   // true\nrange[:4] === [1, 2, 3, 4];   // true\nrange[::2] === [1, 3, 5];     // true\n```\n\n### List Comprehensions\nHam supports list comprehensions, similar in style to Haskell.\n```Javascript\nvar cross = [x*y | x <- range, y <- range[::-1]];\n```\n\n### Friendly Lambda's\nHam makes it fun to use lambda's.\n```Javascript\nvar sum = |x, y| { return x + y; }\n\n// If the body of the lambda is a single expression, \n// then the `return` statement and semicolon can be dropped.\nvar sum = |x, y| { x + y }\n\n// Lambda's are an easy way to iterate a list:\n[1, 2, 3].each(|| { console.log('repeating'); });\n\n// If the lambda takes no parameters, the `||` can be dropped.\n[1, 2, 3].each({ console.log('repeating');});\n\n// When invoking a function with a lambda as the _only_ parameter, the parentheses can be dropped\n[1, 2, 3].each {\n   console.log('repeating');\n};\n```\n\n### Classical Style Inheritence\nSome people would prefer to use Classical Inheritence instead of Javascript's prototypical inheritence, that's fine:\n```Javascript\nclass Hamburger extends MeatMeal {\n   eat: { console.log('om nom nom'); }\n};\n\n// Ham just uses Backbone style .extend() for inheritence, so this translates easily to:\n// var Hamburger = MeatMeal.extend({ ... });\n```\n\n### Operator overloading\nBeing able to overload the default behaviour of javascript operators is sometimes useful:\n```Javascript\nclass Vector {\n  x:0, y:0, z:0,\n  constructor: |x, y, z| { this.x=x; this.y=y; this.z=z; },\n  operator+: |other| { new Vector(this.x+other.x, this.y+other.y, this.z+other.z) }\n};\n\nvar v1 = new Vector(1, 2, 3);\nvar v2 = new Vector(1, 2, 3);\n\nconsole.log(v1 + v2); // === {x: 2, y: 4, z: 6}\n```\n\n### Prototype shortcut\nStolen from Coffeescript, is the prototype shortcut:\n```Javascript\nString::startsWith = |str| { this.substr(0, str.length) === str };\n```\n\n### Numbers as objects\nHam wraps numbers in the javascript built-in Number Object and extends it's prototype with nice things:\n```Javascript\n3.times {\n  console.log('hello world!'); \n};\n```\n\nWhat else is coming?\n---------------------\n\n### Types\nWould be nice to have some inference at compile time, with contracts at runtime for what couldn't be inferred.\n```Javascript\nvar x:string = 3; // TypeError -> typeof \"x\" is string.\nvar sum = |x:num, y:num| { x + y }; // we could infer the return type easily here\nvar idk = ||:string { \"hello\" }; // I'm not sold on the return type syntax here\n```\n\n### Imports\nI like python style imports, but I think it might be hard/impossible to reconcile it with CommonJS style require.\nAnother option is to rewrite a CommonJS style require for the browser, similar to \n[browserify](https://github.com/substack/node-browserify).\n```Javascript\nimport Backbone, _ from 'vendor/backbone'; // would work great for browser, but hard for CommonJS\n```\n\n### Decorators\nI also sometimes find myself with a need for python style Decorators, so Ham will have some form of them.\n```Javascript\n@watch(notify_change)\nvar the_ghost_man = 3;\n```\n\n### Unary Operators\nYeah, I haven't gotten around to unary operators yet.  I've been focussing on the cool stuff for now.\n\n### Loops\nI haven't implemented while or for loops yet, as I am still experimenting with syntax for them.  I've been getting by\nlargely with the combination of ranges and list comprehensions with `.each`.\n\nUsage\n-----\n`npm install -g ham`\nThen write some Ham.js code, and `ham <filename>` to run it.\n","readmeFilename":"README.md","_id":"ham@0.0.8","dist":{"shasum":"464d9db2c9b10ff38c2860b0df7c9b0709a876ee","tarball":"https://registry.npmjs.org/ham/-/ham-0.0.8.tgz","integrity":"sha512-wZ+AOCvAwPLGwnTwKMyeowI3OMMxMP+Om04cWYayVfq7DzbCnbNz8iFjRPSEbhaNifvEyYrDVtMCSeI17JKgKg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHsRVAjo9EHmgtZkR5pvN5PnbJNzdAbRawKwRkpXaW5wAiBe/uG/XmL3PWN9+SS/eG68RseyJ2gFvDrmDY0jIqiFNQ=="}]},"_npmVersion":"1.1.66","_npmUser":{"name":"jameskeane","email":"james.keane@gmail.com"},"maintainers":[{"name":"jameskeane","email":"james.keane@gmail.com"}]},"0.0.9":{"name":"ham","version":"0.0.9","description":"A Hammier Javascript","scripts":{"test":"./node_modules/.bin/cucumber.js","postinstall":"make"},"repository":{"type":"git","url":"https://github.com/jameskeane/ham-script.git"},"main":"src/ham.js","bin":{"ham":"src/main.js"},"keywords":["ham","peg","javascript"],"author":{"name":"James Keane"},"license":"BSD","devDependencies":{"cucumber":"0.3.0","browserify":"1.17.3"},"dependencies":{"canopy":"0.2.0","underscore":"~1.4.3","optimist":"0.3.5","source-map":"git://github.com/jameskeane/source-map.git"},"readme":"Ham -- an altJS language\n=========================\nHam is another altJS language, similar to [CoffeeScript](http://coffeescript.org/).  What makes Ham different is that it is written as a PEG,\nand does not have significant whitespace.  Ham looks very similar to Javascript at first, but offers (hopefully)\nmany useful features.\n\nHam was written using the [Canopy](http://canopy.jcoglan.com/) PEG Parser Generator, and Javascript.  I am\ncurrently working towards self-hosting Ham but it is not quite there yet.\n\nHam is written in an MVC style manner, where model is the AST, view is the javascript translations \n(using ejs templates), and the controller is the tree translators.  This makes Ham extremely easy to hack on, and fun!\n\nSyntax\n------\nSince Ham is extremely similar to Javascript, you can get almost perfect syntax hilighting for free by using the Javascript\nhilighters, which is a pretty neat side effect.\n\n### Array Ranges and Slices\nHam supports [python style](http://stackoverflow.com/a/509295) list ranges and slicing.\n\n```Javascript\nvar range = [1..5];\n\nrange === [1, 2, 3, 4, 5];    // true\nrange[1:] === [2, 3, 4, 5];   // true\nrange[:4] === [1, 2, 3, 4];   // true\nrange[::2] === [1, 3, 5];     // true\n```\n\n### List Comprehensions\nHam supports list comprehensions, similar in style to Haskell.\n```Javascript\nvar cross = [x*y | x <- range, y <- range[::-1]];\n```\n\n### Friendly Lambda's\nHam makes it fun to use lambda's.\n```Javascript\nvar sum = |x, y| { return x + y; }\n\n// If the body of the lambda is a single expression, \n// then the `return` statement and semicolon can be dropped.\nvar sum = |x, y| { x + y }\n\n// Lambda's are an easy way to iterate a list:\n[1, 2, 3].each(|| { console.log('repeating'); });\n\n// If the lambda takes no parameters, the `||` can be dropped.\n[1, 2, 3].each({ console.log('repeating');});\n\n// When invoking a function with a lambda as the _only_ parameter, the parentheses can be dropped\n[1, 2, 3].each {\n   console.log('repeating');\n};\n```\n\n### Classical Style Inheritence\nSome people would prefer to use Classical Inheritence instead of Javascript's prototypical inheritence, that's fine:\n```Javascript\nclass Hamburger extends MeatMeal {\n   eat: { console.log('om nom nom'); }\n};\n\n// Ham just uses Backbone style .extend() for inheritence, so this translates easily to:\n// var Hamburger = MeatMeal.extend({ ... });\n```\n\n### Operator overloading\nBeing able to overload the default behaviour of javascript operators is sometimes useful:\n```Javascript\nclass Vector {\n  x:0, y:0, z:0,\n  constructor: |x, y, z| { this.x=x; this.y=y; this.z=z; },\n  operator+: |other| { new Vector(this.x+other.x, this.y+other.y, this.z+other.z) }\n};\n\nvar v1 = new Vector(1, 2, 3);\nvar v2 = new Vector(1, 2, 3);\n\nconsole.log(v1 + v2); // === {x: 2, y: 4, z: 6}\n```\n\n### Prototype shortcut\nStolen from Coffeescript, is the prototype shortcut:\n```Javascript\nString::startsWith = |str| { this.substr(0, str.length) === str };\n```\n\n### Numbers as objects\nHam wraps numbers in the javascript built-in Number Object and extends it's prototype with nice things:\n```Javascript\n3.times {\n  console.log('hello world!'); \n};\n```\n\nWhat else is coming?\n---------------------\n\n### Types\nWould be nice to have some inference at compile time, with contracts at runtime for what couldn't be inferred.\n```Javascript\nvar x:string = 3; // TypeError -> typeof \"x\" is string.\nvar sum = |x:num, y:num| { x + y }; // we could infer the return type easily here\nvar idk = ||:string { \"hello\" }; // I'm not sold on the return type syntax here\n```\n\n### Imports\nI like python style imports, but I think it might be hard/impossible to reconcile it with CommonJS style require.\nAnother option is to rewrite a CommonJS style require for the browser, similar to \n[browserify](https://github.com/substack/node-browserify).\n```Javascript\nimport Backbone, _ from 'vendor/backbone'; // would work great for browser, but hard for CommonJS\n```\n\n### Decorators\nI also sometimes find myself with a need for python style Decorators, so Ham will have some form of them.\n```Javascript\n@watch(notify_change)\nvar the_ghost_man = 3;\n```\n\n### Unary Operators\nYeah, I haven't gotten around to unary operators yet.  I've been focussing on the cool stuff for now.\n\n### Loops\nI haven't implemented while or for loops yet, as I am still experimenting with syntax for them.  I've been getting by\nlargely with the combination of ranges and list comprehensions with `.each`.\n\nUsage\n-----\n`npm install -g ham`\nThen write some Ham.js code, and `ham <filename>` to run it.\n","readmeFilename":"README.md","_id":"ham@0.0.9","dist":{"shasum":"e5653419766a053042b98230d25d74f5854dee69","tarball":"https://registry.npmjs.org/ham/-/ham-0.0.9.tgz","integrity":"sha512-sz+EoaxId0czhoWGisyLyYQc/pkJ6Z45tZIzADMq+UrzE4DcVA9MgnLcPhy5H+aQ0ox4azBwsPQBZuJ5+YsMTA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDibWaLdto11uTVh+RIKgaw9/A9E1L/MJ4B/t/AK2Vh5gIgFdvg6GT1EvVqcYrZPFYEfHmHJx/tGBzjlhwRR4oNPNM="}]},"_npmVersion":"1.1.66","_npmUser":{"name":"jameskeane","email":"james.keane@gmail.com"},"maintainers":[{"name":"jameskeane","email":"james.keane@gmail.com"}]},"0.1.0":{"name":"ham","version":"0.1.0","description":"A Hammier Javascript","scripts":{"test":"./node_modules/.bin/cucumber.js","postinstall":"make peg"},"repository":{"type":"git","url":"https://github.com/jameskeane/ham-script.git"},"main":"src/ham.js","bin":{"ham":"src/main.js"},"keywords":["ham","peg","javascript"],"author":{"name":"James Keane"},"license":"BSD","devDependencies":{"cucumber":"0.3.0","browserify":"1.17.3"},"dependencies":{"canopy":"0.2.0","underscore":"~1.4.3","optimist":"0.3.5","source-map":"git://github.com/jameskeane/source-map.git"},"readme":"Ham -- an altJS language\n=========================\nHam is another altJS language, similar to [CoffeeScript](http://coffeescript.org/).  What makes Ham different is that it is written as a PEG,\nand does not have significant whitespace.  Ham looks very similar to Javascript at first, but offers (hopefully)\nmany useful features.\n\nHam was written using the [Canopy](http://canopy.jcoglan.com/) PEG Parser Generator, and Javascript.  I am\ncurrently working towards self-hosting Ham but it is not quite there yet.\n\nHam is written in an MVC style manner, where model is the AST, view is the javascript translations \n(using ejs templates), and the controller is the tree translators.  This makes Ham extremely easy to hack on, and fun!\n\nSyntax\n------\nSince Ham is extremely similar to Javascript, you can get almost perfect syntax hilighting for free by using the Javascript\nhilighters, which is a pretty neat side effect.\n\n### Array Ranges and Slices\nHam supports [python style](http://stackoverflow.com/a/509295) list ranges and slicing.\n\n```Javascript\nvar range = [1..5];\n\nrange === [1, 2, 3, 4, 5];    // true\nrange[1:] === [2, 3, 4, 5];   // true\nrange[:4] === [1, 2, 3, 4];   // true\nrange[::2] === [1, 3, 5];     // true\n```\n\n### List Comprehensions\nHam supports list comprehensions, similar in style to Haskell.\n```Javascript\nvar cross = [x*y | x <- range, y <- range[::-1]];\n```\n\n### Friendly Lambda's\nHam makes it fun to use lambda's.\n```Javascript\nvar sum = |x, y| { return x + y; }\n\n// If the body of the lambda is a single expression, \n// then the `return` statement and semicolon can be dropped.\nvar sum = |x, y| { x + y }\n\n// Lambda's are an easy way to iterate a list:\n[1, 2, 3].each(|| { console.log('repeating'); });\n\n// If the lambda takes no parameters, the `||` can be dropped.\n[1, 2, 3].each({ console.log('repeating');});\n\n// When invoking a function with a lambda as the _only_ parameter, the parentheses can be dropped\n[1, 2, 3].each {\n   console.log('repeating');\n};\n```\n\n### Classical Style Inheritence\nSome people would prefer to use Classical Inheritence instead of Javascript's prototypical inheritence, that's fine:\n```Javascript\nclass Hamburger extends MeatMeal {\n   eat: { console.log('om nom nom'); }\n};\n\n// Ham just uses Backbone style .extend() for inheritence, so this translates easily to:\n// var Hamburger = MeatMeal.extend({ ... });\n```\n\n### Operator overloading\nBeing able to overload the default behaviour of javascript operators is sometimes useful:\n```Javascript\nclass Vector {\n  x:0, y:0, z:0,\n  constructor: |x, y, z| { this.x=x; this.y=y; this.z=z; },\n  operator+: |other| { new Vector(this.x+other.x, this.y+other.y, this.z+other.z) }\n};\n\nvar v1 = new Vector(1, 2, 3);\nvar v2 = new Vector(1, 2, 3);\n\nconsole.log(v1 + v2); // === {x: 2, y: 4, z: 6}\n```\n\n### Prototype shortcut\nStolen from Coffeescript, is the prototype shortcut:\n```Javascript\nString::startsWith = |str| { this.substr(0, str.length) === str };\n```\n\n### Numbers as objects\nHam wraps numbers in the javascript built-in Number Object and extends it's prototype with nice things:\n```Javascript\n3.times {\n  console.log('hello world!'); \n};\n```\n\nWhat else is coming?\n---------------------\n\n### Types\nWould be nice to have some inference at compile time, with contracts at runtime for what couldn't be inferred.\n```Javascript\nvar x:string = 3; // TypeError -> typeof \"x\" is string.\nvar sum = |x:num, y:num| { x + y }; // we could infer the return type easily here\nvar idk = ||:string { \"hello\" }; // I'm not sold on the return type syntax here\n```\n\n### Imports\nI like python style imports, but I think it might be hard/impossible to reconcile it with CommonJS style require.\nAnother option is to rewrite a CommonJS style require for the browser, similar to \n[browserify](https://github.com/substack/node-browserify).\n```Javascript\nimport Backbone, _ from 'vendor/backbone'; // would work great for browser, but hard for CommonJS\n```\n\n### Decorators\nI also sometimes find myself with a need for python style Decorators, so Ham will have some form of them.\n```Javascript\n@watch(notify_change)\nvar the_ghost_man = 3;\n```\n\n### Unary Operators\nYeah, I haven't gotten around to unary operators yet.  I've been focussing on the cool stuff for now.\n\n### Loops\nI haven't implemented while or for loops yet, as I am still experimenting with syntax for them.  I've been getting by\nlargely with the combination of ranges and list comprehensions with `.each`.\n\nUsage\n-----\n`npm install -g ham`\nThen write some Ham.js code, and `ham <filename>` to run it.\n","readmeFilename":"README.md","_id":"ham@0.1.0","dist":{"shasum":"fce80e125869dbab591b20adf157e823f0f3f7b1","tarball":"https://registry.npmjs.org/ham/-/ham-0.1.0.tgz","integrity":"sha512-I4nydkZSWNSTKcOnVGwhqCh985gWcn3qMbRTZSTCMwwjOVnxgeNl2fBRrKEsllaRO2Lw+zIQ8zRT6UcDjQh3dg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDPe9yGAfTzWFJC4QtJQj+DzuWJ/hfmX7hZWOIpZmEbegIgT8D8YbnxrKUiiLx/TsWV+EPGLWQnba+5Q1vbeZ47Zpo="}]},"_npmVersion":"1.1.66","_npmUser":{"name":"jameskeane","email":"james.keane@gmail.com"},"maintainers":[{"name":"jameskeane","email":"james.keane@gmail.com"}]},"0.1.1":{"name":"ham","version":"0.1.1","description":"A Hammier Javascript","scripts":{"test":"./node_modules/.bin/cucumber.js","postinstall":"make peg"},"repository":{"type":"git","url":"https://github.com/jameskeane/ham-script.git"},"main":"src/ham.js","bin":{"ham":"src/main.js"},"keywords":["ham","peg","javascript"],"author":{"name":"James Keane"},"license":"BSD","devDependencies":{"cucumber":"0.3.0","browserify":"1.17.3"},"dependencies":{"canopy":"0.2.0","underscore":"~1.4.3","optimist":"0.3.5","source-map":"git://github.com/jameskeane/source-map.git"},"readme":"Ham -- an altJS language\n=========================\nHam is another altJS language, similar to [CoffeeScript](http://coffeescript.org/).  What makes Ham different is that it is written as a PEG,\nand does not have significant whitespace.  Ham looks very similar to Javascript at first, but offers (hopefully)\nmany useful features.\n\nHam was written using the [Canopy](http://canopy.jcoglan.com/) PEG Parser Generator, and Javascript.  I am\ncurrently working towards self-hosting Ham but it is not quite there yet.\n\nHam is written in an MVC style manner, where model is the AST, view is the javascript translations \n(using ejs templates), and the controller is the tree translators.  This makes Ham extremely easy to hack on, and fun!\n\nSyntax\n------\nSince Ham is extremely similar to Javascript, you can get almost perfect syntax hilighting for free by using the Javascript\nhilighters, which is a pretty neat side effect.\n\n### Array Ranges and Slices\nHam supports [python style](http://stackoverflow.com/a/509295) list ranges and slicing.\n\n```Javascript\nvar range = [1..5];\n\nrange === [1, 2, 3, 4, 5];    // true\nrange[1:] === [2, 3, 4, 5];   // true\nrange[:4] === [1, 2, 3, 4];   // true\nrange[::2] === [1, 3, 5];     // true\n```\n\n### List Comprehensions\nHam supports list comprehensions, similar in style to Haskell.\n```Javascript\nvar cross = [x*y | x <- range, y <- range[::-1]];\n```\n\n### Friendly Lambda's\nHam makes it fun to use lambda's.\n```Javascript\nvar sum = |x, y| { return x + y; }\n\n// If the body of the lambda is a single expression, \n// then the `return` statement and semicolon can be dropped.\nvar sum = |x, y| { x + y }\n\n// Lambda's are an easy way to iterate a list:\n[1, 2, 3].each(|| { console.log('repeating'); });\n\n// If the lambda takes no parameters, the `||` can be dropped.\n[1, 2, 3].each({ console.log('repeating');});\n\n// When invoking a function with a lambda as the _only_ parameter, the parentheses can be dropped\n[1, 2, 3].each {\n   console.log('repeating');\n};\n```\n\n### Classical Style Inheritence\nSome people would prefer to use Classical Inheritence instead of Javascript's prototypical inheritence, that's fine:\n```Javascript\nclass Hamburger extends MeatMeal {\n   eat: { console.log('om nom nom'); }\n};\n\n// Ham just uses Backbone style .extend() for inheritence, so this translates easily to:\n// var Hamburger = MeatMeal.extend({ ... });\n```\n\n### Operator overloading\nBeing able to overload the default behaviour of javascript operators is sometimes useful:\n```Javascript\nclass Vector {\n  x:0, y:0, z:0,\n  constructor: |x, y, z| { this.x=x; this.y=y; this.z=z; },\n  operator+: |other| { new Vector(this.x+other.x, this.y+other.y, this.z+other.z) }\n};\n\nvar v1 = new Vector(1, 2, 3);\nvar v2 = new Vector(1, 2, 3);\n\nconsole.log(v1 + v2); // === {x: 2, y: 4, z: 6}\n```\n\n### Prototype shortcut\nStolen from Coffeescript, is the prototype shortcut:\n```Javascript\nString::startsWith = |str| { this.substr(0, str.length) === str };\n```\n\n### Numbers as objects\nHam wraps numbers in the javascript built-in Number Object and extends it's prototype with nice things:\n```Javascript\n3.times {\n  console.log('hello world!'); \n};\n```\n\n### Function Guards\nAnother thing from functional languages is the function guard, it requires that all expressions evaluate to true otherwise\nthe function does not run.\n```Javascript\nvar x = | y < 3 | { y + 3 }\nx(5) === undefined;\nx(2) === 5;\n```\n\nWhat else is coming?\n---------------------\n\n### Types\nWould be nice to have some inference at compile time, with contracts at runtime for what couldn't be inferred.\n```Javascript\nvar x:string = 3; // TypeError -> typeof \"x\" is string.\nvar sum = |x:num, y:num| { x + y }; // we could infer the return type easily here\nvar idk = ||:string { \"hello\" }; // I'm not sold on the return type syntax here\n```\n\n### Imports\nI like python style imports, but I think it might be hard/impossible to reconcile it with CommonJS style require.\nAnother option is to rewrite a CommonJS style require for the browser, similar to \n[browserify](https://github.com/substack/node-browserify).\n```Javascript\nimport Backbone, _ from 'vendor/backbone'; // would work great for browser, but hard for CommonJS\n```\n\n### Decorators\nI also sometimes find myself with a need for python style Decorators, so Ham will have some form of them.\n```Javascript\n@watch(notify_change)\nvar the_ghost_man = 3;\n```\n\n### Unary Operators\nYeah, I haven't gotten around to unary operators yet.  I've been focussing on the cool stuff for now.\n\n### Loops\nI haven't implemented while or for loops yet, as I am still experimenting with syntax for them.  I've been getting by\nlargely with the combination of ranges and list comprehensions with `.each`.\n\n### do and while are just runtime functions\nNow that we have function guards we can do some pretty crazy stuff, like make do and while standard functions\n```Javascript\nwhile | x < 3 | { x++ }\n```\n\n\nUsage\n-----\n`npm install -g ham`\nThen write some Ham.js code, and `ham <filename>` to run it.\n","readmeFilename":"README.md","_id":"ham@0.1.1","dist":{"shasum":"73b5479ba482e9c6c278ba637f92c3af20921439","tarball":"https://registry.npmjs.org/ham/-/ham-0.1.1.tgz","integrity":"sha512-8eU+nzkpw7w1GJKwb8hLP5A7lnzCHz0VaE7+fu/hu/nZ7ICcgJSMFHzVbf+92f8eowLAhpADxlGEYXR0VOPQCA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQClxSQs7KQjfj1/thORWprV6czXYbgcMaj+bR8aUqW0tgIhAMUJgGAac2pCb/+UUaE31eTMgr2+OvJVrpM6Ei4936W0"}]},"_npmVersion":"1.1.66","_npmUser":{"name":"jameskeane","email":"james.keane@gmail.com"},"maintainers":[{"name":"jameskeane","email":"james.keane@gmail.com"}]}},"readme":"Ham -- an altJS language\n=========================\nHam is another altJS language, similar to [CoffeeScript](http://coffeescript.org/).  What makes Ham different is that it is written as a PEG,\nand does not have significant whitespace.  Ham looks very similar to Javascript at first, but offers (hopefully)\nmany useful features.\n\nHam was written using the [Canopy](http://canopy.jcoglan.com/) PEG Parser Generator, and Javascript.  I am\ncurrently working towards self-hosting Ham but it is not quite there yet.\n\nHam is written in an MVC style manner, where model is the AST, view is the javascript translations \n(using ejs templates), and the controller is the tree translators.  This makes Ham extremely easy to hack on, and fun!\n\nSyntax\n------\nSince Ham is extremely similar to Javascript, you can get almost perfect syntax hilighting for free by using the Javascript\nhilighters, which is a pretty neat side effect.\n\n### Array Ranges and Slices\nHam supports [python style](http://stackoverflow.com/a/509295) list ranges and slicing.\n\n```Javascript\nvar range = [1..5];\n\nrange === [1, 2, 3, 4, 5];    // true\nrange[1:] === [2, 3, 4, 5];   // true\nrange[:4] === [1, 2, 3, 4];   // true\nrange[::2] === [1, 3, 5];     // true\n```\n\n### List Comprehensions\nHam supports list comprehensions, similar in style to Haskell.\n```Javascript\nvar cross = [x*y | x <- range, y <- range[::-1]];\n```\n\n### Friendly Lambda's\nHam makes it fun to use lambda's.\n```Javascript\nvar sum = |x, y| { return x + y; }\n\n// If the body of the lambda is a single expression, \n// then the `return` statement and semicolon can be dropped.\nvar sum = |x, y| { x + y }\n\n// Lambda's are an easy way to iterate a list:\n[1, 2, 3].each(|| { console.log('repeating'); });\n\n// If the lambda takes no parameters, the `||` can be dropped.\n[1, 2, 3].each({ console.log('repeating');});\n\n// When invoking a function with a lambda as the _only_ parameter, the parentheses can be dropped\n[1, 2, 3].each {\n   console.log('repeating');\n};\n```\n\n### Classical Style Inheritence\nSome people would prefer to use Classical Inheritence instead of Javascript's prototypical inheritence, that's fine:\n```Javascript\nclass Hamburger extends MeatMeal {\n   eat: { console.log('om nom nom'); }\n};\n\n// Ham just uses Backbone style .extend() for inheritence, so this translates easily to:\n// var Hamburger = MeatMeal.extend({ ... });\n```\n\n### Prototype shortcut\nStolen from Coffeescript, is the prototype shortcut:\n```Javascript\nString::startsWith = |str| { this.substr(0, str.length) === str };\n```\n\nWhat else is comming?\n---------------------\n\n### Types\nWould be nice to have some inference at compile time, with contracts at runtime for what couldn't be inferred.\n```Javascript\nvar x:string = 3; // TypeError -> typeof \"x\" is string.\nvar sum = |x:num, y:num| { x + y }; // we could infer the return type easily here\nvar idk = ||:string { \"hello\" }; // I'm not sold on the return type syntax here\n```\n\n### Imports\nI like python style imports, but I think it might be hard/impossible to reconcile it with CommonJS style require.\nAnother option is to rewrite a CommonJS style require for the browser, similar to \n[browserify](https://github.com/substack/node-browserify).\n```Javascript\nimport Backbone, _ from 'vendor/backbone'; // would work great for browser, but hard for CommonJS\n```\n\n### Decorators\nI also sometimes find myself with a need for python style Decorators, so Ham will have some form of them.\n```Javascript\n@watch(notify_change)\nvar the_ghost_man = 3;\n```\n\n### Unary Operators\nYeah, I haven't gotten around to unary operators yet.  I've been focussing on the cool stuff for now.\n\n### Loops\nI haven't implemented while or for loops yet, as I am still experimenting with syntax for them.  I've been getting by\nlargely with the combination of ranges and list comprehensions with `.each`.\n\nUsage\n-----\n`npm install -g ham`\nThen write some Ham.js code, and `ham <filename>` to run it.","maintainers":[{"name":"jameskeane","email":"james.keane@gmail.com"}],"time":{"modified":"2022-06-18T18:47:53.679Z","created":"2013-01-30T13:03:26.823Z","0.0.5":"2013-01-30T13:03:27.689Z","0.0.7":"2013-02-01T00:13:32.099Z","0.0.8":"2013-02-01T03:05:08.145Z","0.0.9":"2013-02-01T03:41:53.785Z","0.1.0":"2013-02-01T03:44:15.984Z","0.1.1":"2013-02-02T20:04:40.191Z"},"author":{"name":"James Keane"},"repository":{"type":"git","url":"https://github.com/jameskeane/ham-script.git"}}