The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:
Language.js is an experimental new parser based on PEG (Parsing Expression Grammar), with the special addition of the "naughty OR" operator to handle errors in a unique new way. It makes use of memoization to achieve linear time parsing speed, and support for automatic cut placement is coming to maintain mostly constant space as well (for a discussion of cut operators see: www.ialab.cs.tsukuba.ac.jp/~mizusima/publications/paste513-mizushima.pdf).
You can read about general PEG features on the wikipedia page here: http://en.wikipedia.org/wiki/Parsingexpressiongrammar
The most unique addition Language.js makes to PEG is how it handles errors. No parse ever fails in Language.js, instead SyntaxErrorNodes are placed into the resultant tree. This makes it trivial to do things like write syntax highlighters that have live error reporting. This also means that Language.js is very competent at handling multiple errors (as opposed to aborting on the first one that is reached).
Identifier = !(ReservedWord !IdentifierPart) IdentifierName % ReservedWordIdentifier
ReservedWordIdentifier = ReservedWord !IdentifierPart
generates the following error message with no additional code for "new = 5":
new = 5; ^^^ ERROR line 0: Identifier can't be a reserved word.