A programming language derived from JavaScript which emphasizes prototypes, integrity, and syntax.
JavaScript CSS
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
docs
lib
runtime
test
tools
.gitignore
.gitmodules
CONTRIBUTING.md
LICENSE.md
README.md
package.json

README.md

Proto

Proto is a programming language that compiles to JavaScript. It emphasizes prototypal programming, high integrity, and fluent, disambiguated syntax. It is currently in active development and highly experimental.

Proto uses ECMAScript 6 as a foundation, but deviates significantly -- even replacing the meta-object protocol. Though Proto is like JavaScript, Proto is not JavaScript. Unlike CoffeeScript, Proto is not simply syntactic changes layered into the JavaScript language -- it fundamentally differs in many aspects of the language.

Documentation

To learn about the Proto language, please see the documentation.

Feature List

Proto supports the following features. Some of the features are expected to be in either ECMAScript 6 or 7, while others are unique to Proto.

ECMAScript 6

  • Destructuring
  • Default Parameters
  • Rest Operator
  • Spread Operator
  • Parameter Defaults
  • Symbols
  • Map, Set, WeakMap, WeakSet
  • Modules
  • Generators
  • Promises
  • Comprehensions
  • Block Scoping
  • const
  • for..of
  • Reflection API
  • 0b0101 and 0o12537 syntax for binary and octal numeric literals

ECMAScript 7 (expected)

Other

  • Coercives
  • Slots
  • Syntax for symbols (@name)
  • Symbols are private
  • Statements as expressions
  • Ranges (.., ..., by)
  • Inheritance Operator (like)
  • Nil-Coalescing Operator (??)
  • Conditional Properties (?)
  • Mixin Operator (:=)
  • Concatenation Operator (&)
  • Same Value Operator (is)
  • Generic Negation Operators (!in, !is, !like)
  • Switch statements that don't default to fall-through
  • Much more

Use

(Note: The npm version is currently sorely out of date. For the latest, you'll need to clone from github.)

npm install protolang -g

In a JS project:

var proto = require('protolang');

var jsSource = proto.compile(protoSource);
// ...

There is also a tools/ directory with a command-line compiler (protoc) and a simple server (server).

Command-Line Compiler

$ node protoc /path/to/file.pr

This will output the compiled JavaScript to stdout. You can pipe it elsewhere or redirect it to a file using your OS pipes and redirects.

Simple Proto->JS Server

$ node server /path/to/root/dir --port 3000
Server running on port 3000

This simple server can be useful when developing Proto scripts so that you don't have to constantly compile them. It will only serve .proto files and it will compile them to JavaScript on the fly.

Contributions

If you would like to contribute, see the code guide.


CC0
To the extent possible under law, Nathan Wall has waived all copyright and related or neighboring rights to Proto.

This work is published from:
<span property="vcard:Country" datatype="dct:ISO3166" content="US">
  United States
</span>.