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.
To learn about the Proto language, please see the documentation.
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.
Map
, Set
, WeakMap
, WeakSet
const
for
..of
0b0101
and 0o12537
syntax for binary and octal numeric literals@name
)..
, ...
, by
)like
)??
)?
):=
)&
)is
)!in
, !is
, !like
)(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
).
$ 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.
$ 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.
If you would like to contribute, see the code guide.
To the extent possible under law,
Nathan Wall
has waived all copyright and related or neighboring rights to
Proto.
This work is published from:
United States
.