{"action":"created","comment":{"url":"https://api.github.com/repos/CindyJS/CindyJS/pulls/comments/57305054","id":57305054,"diff_hunk":"@@ -1,16 +1,18 @@\n \"use strict\";\n \n exports.libcs = [\n-    \"src/js/libcs/Namespace.js\",\n-    \"src/js/libcs/Accessors.js\",\n     \"src/js/libcs/CSNumber.js\",\n     \"src/js/libcs/List.js\",\n-    \"src/js/libcs/Essentials.js\",\n     \"src/js/libcs/General.js\",\n+    \"src/js/libcs/Essentials.js\",\n+    \"src/js/libcs/Namespace.js\",\n+    \"build/js/Compiled.js\",","path":"make/sources.js","position":12,"original_position":12,"commit_id":"eb648f4b06dc2ce84e028ba139878439e2933322","original_commit_id":"e6755ff2de919e9cd22c362233d50e09b32b50c3","user":{"login":"gagern","id":190759,"avatar_url":"https://avatars.githubusercontent.com/u/190759?v=3","gravatar_id":"","url":"https://api.github.com/users/gagern","html_url":"https://github.com/gagern","followers_url":"https://api.github.com/users/gagern/followers","following_url":"https://api.github.com/users/gagern/following{/other_user}","gists_url":"https://api.github.com/users/gagern/gists{/gist_id}","starred_url":"https://api.github.com/users/gagern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gagern/subscriptions","organizations_url":"https://api.github.com/users/gagern/orgs","repos_url":"https://api.github.com/users/gagern/repos","events_url":"https://api.github.com/users/gagern/events{/privacy}","received_events_url":"https://api.github.com/users/gagern/received_events","type":"User","site_admin":false},"body":"That's JavaScript code transpiled from CindyScript. Perhaps I should choose a different name here. Any suggestions?","created_at":"2016-03-24T11:36:19Z","updated_at":"2016-03-24T11:36:19Z","html_url":"https://github.com/CindyJS/CindyJS/pull/257#discussion_r57305054","pull_request_url":"https://api.github.com/repos/CindyJS/CindyJS/pulls/257","_links":{"self":{"href":"https://api.github.com/repos/CindyJS/CindyJS/pulls/comments/57305054"},"html":{"href":"https://github.com/CindyJS/CindyJS/pull/257#discussion_r57305054"},"pull_request":{"href":"https://api.github.com/repos/CindyJS/CindyJS/pulls/257"}}},"pull_request":{"url":"https://api.github.com/repos/CindyJS/CindyJS/pulls/257","id":59568872,"html_url":"https://github.com/CindyJS/CindyJS/pull/257","diff_url":"https://github.com/CindyJS/CindyJS/pull/257.diff","patch_url":"https://github.com/CindyJS/CindyJS/pull/257.patch","issue_url":"https://api.github.com/repos/CindyJS/CindyJS/issues/257","number":257,"state":"open","locked":false,"title":"Reimplemented parser","user":{"login":"gagern","id":190759,"avatar_url":"https://avatars.githubusercontent.com/u/190759?v=3","gravatar_id":"","url":"https://api.github.com/users/gagern","html_url":"https://github.com/gagern","followers_url":"https://api.github.com/users/gagern/followers","following_url":"https://api.github.com/users/gagern/following{/other_user}","gists_url":"https://api.github.com/users/gagern/gists{/gist_id}","starred_url":"https://api.github.com/users/gagern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gagern/subscriptions","organizations_url":"https://api.github.com/users/gagern/orgs","repos_url":"https://api.github.com/users/gagern/repos","events_url":"https://api.github.com/users/gagern/events{/privacy}","received_events_url":"https://api.github.com/users/gagern/received_events","type":"User","site_admin":false},"body":"This is a change which will have a huge impact. So I don't expect this to be merged right now, but instead to be **discussed** and brought into a shape where it can be merged without causing pain for anyone. Essentially, this is a **rewrite of the parser**.\r\n\r\nThe old parser operated on strings, and used to repeatedly iterate over the same strings, causing something like an O(*n*<sup>2</sup>) time complexity. The new parser turns the input text into a token stream, and then builds expressions from these tokens in what looks like linear time to me. There is a **factor 5 performance boost**, reducing the time needed to parse all the scripts from all the examples from 2.5s to 0.5s, which is quite considerable in my opinion.\r\n\r\nThe parser is also more **modular**. The single file `Parser.js` can be used by other projects without depending on the rest of CindyJS. This is useful for applications like using CIndyScript at compile time, or building a CindyScript editor with syntax checking and highlighting. The CindyJS internals `infixmap` and `namespace` are still coupled via a shared scope, but there might be a more elegant way to deal with these in the long run.\r\n\r\nThe modularity can also be put to use in **unit tests**, comparing text input against expected parse results. The parser comes with a bunch of such unit tests, and may wel be extended to explicitely cover tricky cases of the language specification in the future.\r\n\r\nWhile the parser keeps the CindyScript tradition of **ignoring whitespace**, it does so during tokenization, **without actually removing whitespace** from the input. That allows much greater flexibility in translating back and forth between parsed syntax and input text. This feature is essential for syntax highlighting. The parsed tokens already come with row and column source code position information. With moderate amounts of work it should be possible to extend that information to all nodes of the abstract syntax tree.\r\n\r\nFor convenience, the new parser was written in EcmaScript 2015 a.k.a. **ES6**. The build system has Closure compile that to ES5 so it will continue to run on most browsers. But internal tools like unit tests now may and will use ES6 syntax, as suppoered by node 4 and later. So we bump the node requirement from 0.12 to 4.0. **If desired, I could rewrite the parser in ES5.** There is nothing about it that couldn't be expressed in ES5 as well, with probably a few more lines of code.\r\n\r\nThe language parsed by the parser is ***not* the same language** Cinderella or the previous CindyJS parser recognizes.\r\n\r\n* Operator precedence has been modified with the aim of more consistent behavior.\r\nCompare the new `operatorLevels` data structure with the old `operators` dictionary.\r\n* Some operations like `^` and `=` are right-associative.\r\nLook for the `rassoc` key in `operatorLevels`.\r\n* The dot `.` may no longer be used to denote a zero.\r\n* The dot now becomes part of numeric literal tokens, which means `7.x` reports a lacking operator between `7.` and `x`, where Cinderella treats this as the field `x` of the object `7`, which apparently is `7`.\r\n* Multiple dots are parsed as Cinderella does: `1..3` is the range, not the literal `1.` followed by the literal `.3`. `1...3` would be `1 .. .3`.\r\n* Numeric literals may now be written in scientific notation, e.g. `1e-3`.\r\n* Many operators now come with unicode variants of the symbol, for better readability in some scenarios.\r\n* The parser is more strict; it will issue a compile-time error where other implementations used to just return nada at runtime. This is particularly true for fixity checks in `applyOperator`.\r\n* `|…|` may now be nested, as long as it is enclosed in a bracket of a different type. This is thanks to the recursive parsing, which allows `|x, f(|y|)|` to work as expected.\r\n* A name may not start with a numeric literal. While Cinderella allows `4by4` to be used as a variable name, this new parser will tokenize this as the numeric literal `4` followed by the identifier `by4`.\r\n* Names of fields and modifiers have to be identifiers.\r\n* Modifiers may not be enclosed in parentheses.\r\n* Like Cinderella but unlike current CindyJS, function names now follow the same rules as variable names, which in particular means that the builtin function `#drawgrid` has to be renamed.\r\n\r\nThis pull request is **closely related to #248**. I guess this one here is much more controversial than that one, so I expect that one to be merged before this here is ready, and will then merge it into my branch here as well.\r\n\r\nI haven't cleaned out the old parser yet. Once we reach consensus on the new parser, I intend to **remove the old parser** before this whole thing gets merged.\r\n\r\n**Please discuss** the changes pointed out above, voice any objections you have to them, and any additional features you'd like to see included. Please also have a look at the code and let me know if I should do anything to make it easier to understand and maintain.\r\n\r\nIf we reach consensus here, I'll try to write a **similar parser for Cinderella**, to keep the two implementations compatible. Most likely Cinderella will then have two independent parsers, one for backwards compatibility and one for newer code, with the option to switch between them at will.","created_at":"2016-02-16T22:57:50Z","updated_at":"2016-03-24T11:36:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fc99dad4510e7c4489e69aef16fc5b0fe4295eaa","assignee":{"login":"strobelm","id":14185442,"avatar_url":"https://avatars.githubusercontent.com/u/14185442?v=3","gravatar_id":"","url":"https://api.github.com/users/strobelm","html_url":"https://github.com/strobelm","followers_url":"https://api.github.com/users/strobelm/followers","following_url":"https://api.github.com/users/strobelm/following{/other_user}","gists_url":"https://api.github.com/users/strobelm/gists{/gist_id}","starred_url":"https://api.github.com/users/strobelm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strobelm/subscriptions","organizations_url":"https://api.github.com/users/strobelm/orgs","repos_url":"https://api.github.com/users/strobelm/repos","events_url":"https://api.github.com/users/strobelm/events{/privacy}","received_events_url":"https://api.github.com/users/strobelm/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/CindyJS/CindyJS/milestones/1","html_url":"https://github.com/CindyJS/CindyJS/milestones/v1.0.0","labels_url":"https://api.github.com/repos/CindyJS/CindyJS/milestones/1/labels","id":1383222,"number":1,"title":"v1.0.0","description":"Version 1.0.0 would be the first official release. CindyJS should from then on follow [semantic versioning](http://semver.org/).","creator":{"login":"gagern","id":190759,"avatar_url":"https://avatars.githubusercontent.com/u/190759?v=3","gravatar_id":"","url":"https://api.github.com/users/gagern","html_url":"https://github.com/gagern","followers_url":"https://api.github.com/users/gagern/followers","following_url":"https://api.github.com/users/gagern/following{/other_user}","gists_url":"https://api.github.com/users/gagern/gists{/gist_id}","starred_url":"https://api.github.com/users/gagern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gagern/subscriptions","organizations_url":"https://api.github.com/users/gagern/orgs","repos_url":"https://api.github.com/users/gagern/repos","events_url":"https://api.github.com/users/gagern/events{/privacy}","received_events_url":"https://api.github.com/users/gagern/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":24,"state":"open","created_at":"2015-10-29T11:06:50Z","updated_at":"2016-03-08T20:52:01Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/CindyJS/CindyJS/pulls/257/commits","review_comments_url":"https://api.github.com/repos/CindyJS/CindyJS/pulls/257/comments","review_comment_url":"https://api.github.com/repos/CindyJS/CindyJS/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CindyJS/CindyJS/issues/257/comments","statuses_url":"https://api.github.com/repos/CindyJS/CindyJS/statuses/eb648f4b06dc2ce84e028ba139878439e2933322","head":{"label":"gagern:newParser","ref":"newParser","sha":"eb648f4b06dc2ce84e028ba139878439e2933322","user":{"login":"gagern","id":190759,"avatar_url":"https://avatars.githubusercontent.com/u/190759?v=3","gravatar_id":"","url":"https://api.github.com/users/gagern","html_url":"https://github.com/gagern","followers_url":"https://api.github.com/users/gagern/followers","following_url":"https://api.github.com/users/gagern/following{/other_user}","gists_url":"https://api.github.com/users/gagern/gists{/gist_id}","starred_url":"https://api.github.com/users/gagern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gagern/subscriptions","organizations_url":"https://api.github.com/users/gagern/orgs","repos_url":"https://api.github.com/users/gagern/repos","events_url":"https://api.github.com/users/gagern/events{/privacy}","received_events_url":"https://api.github.com/users/gagern/received_events","type":"User","site_admin":false},"repo":{"id":42124777,"name":"CindyJS","full_name":"gagern/CindyJS","owner":{"login":"gagern","id":190759,"avatar_url":"https://avatars.githubusercontent.com/u/190759?v=3","gravatar_id":"","url":"https://api.github.com/users/gagern","html_url":"https://github.com/gagern","followers_url":"https://api.github.com/users/gagern/followers","following_url":"https://api.github.com/users/gagern/following{/other_user}","gists_url":"https://api.github.com/users/gagern/gists{/gist_id}","starred_url":"https://api.github.com/users/gagern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gagern/subscriptions","organizations_url":"https://api.github.com/users/gagern/orgs","repos_url":"https://api.github.com/users/gagern/repos","events_url":"https://api.github.com/users/gagern/events{/privacy}","received_events_url":"https://api.github.com/users/gagern/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gagern/CindyJS","description":"A JavaScript framework for interactive (mathematical) content","fork":true,"url":"https://api.github.com/repos/gagern/CindyJS","forks_url":"https://api.github.com/repos/gagern/CindyJS/forks","keys_url":"https://api.github.com/repos/gagern/CindyJS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gagern/CindyJS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gagern/CindyJS/teams","hooks_url":"https://api.github.com/repos/gagern/CindyJS/hooks","issue_events_url":"https://api.github.com/repos/gagern/CindyJS/issues/events{/number}","events_url":"https://api.github.com/repos/gagern/CindyJS/events","assignees_url":"https://api.github.com/repos/gagern/CindyJS/assignees{/user}","branches_url":"https://api.github.com/repos/gagern/CindyJS/branches{/branch}","tags_url":"https://api.github.com/repos/gagern/CindyJS/tags","blobs_url":"https://api.github.com/repos/gagern/CindyJS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gagern/CindyJS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gagern/CindyJS/git/refs{/sha}","trees_url":"https://api.github.com/repos/gagern/CindyJS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gagern/CindyJS/statuses/{sha}","languages_url":"https://api.github.com/repos/gagern/CindyJS/languages","stargazers_url":"https://api.github.com/repos/gagern/CindyJS/stargazers","contributors_url":"https://api.github.com/repos/gagern/CindyJS/contributors","subscribers_url":"https://api.github.com/repos/gagern/CindyJS/subscribers","subscription_url":"https://api.github.com/repos/gagern/CindyJS/subscription","commits_url":"https://api.github.com/repos/gagern/CindyJS/commits{/sha}","git_commits_url":"https://api.github.com/repos/gagern/CindyJS/git/commits{/sha}","comments_url":"https://api.github.com/repos/gagern/CindyJS/comments{/number}","issue_comment_url":"https://api.github.com/repos/gagern/CindyJS/issues/comments{/number}","contents_url":"https://api.github.com/repos/gagern/CindyJS/contents/{+path}","compare_url":"https://api.github.com/repos/gagern/CindyJS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gagern/CindyJS/merges","archive_url":"https://api.github.com/repos/gagern/CindyJS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gagern/CindyJS/downloads","issues_url":"https://api.github.com/repos/gagern/CindyJS/issues{/number}","pulls_url":"https://api.github.com/repos/gagern/CindyJS/pulls{/number}","milestones_url":"https://api.github.com/repos/gagern/CindyJS/milestones{/number}","notifications_url":"https://api.github.com/repos/gagern/CindyJS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gagern/CindyJS/labels{/name}","releases_url":"https://api.github.com/repos/gagern/CindyJS/releases{/id}","deployments_url":"https://api.github.com/repos/gagern/CindyJS/deployments","created_at":"2015-09-08T16:29:07Z","updated_at":"2016-01-21T18:10:16Z","pushed_at":"2016-03-24T08:13:37Z","git_url":"git://github.com/gagern/CindyJS.git","ssh_url":"git@github.com:gagern/CindyJS.git","clone_url":"https://github.com/gagern/CindyJS.git","svn_url":"https://github.com/gagern/CindyJS","homepage":null,"size":14629,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"CindyJS:master","ref":"master","sha":"78633f577f529beef1ea4f642d5f8c7865ef64dd","user":{"login":"CindyJS","id":14181218,"avatar_url":"https://avatars.githubusercontent.com/u/14181218?v=3","gravatar_id":"","url":"https://api.github.com/users/CindyJS","html_url":"https://github.com/CindyJS","followers_url":"https://api.github.com/users/CindyJS/followers","following_url":"https://api.github.com/users/CindyJS/following{/other_user}","gists_url":"https://api.github.com/users/CindyJS/gists{/gist_id}","starred_url":"https://api.github.com/users/CindyJS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CindyJS/subscriptions","organizations_url":"https://api.github.com/users/CindyJS/orgs","repos_url":"https://api.github.com/users/CindyJS/repos","events_url":"https://api.github.com/users/CindyJS/events{/privacy}","received_events_url":"https://api.github.com/users/CindyJS/received_events","type":"Organization","site_admin":false},"repo":{"id":42122684,"name":"CindyJS","full_name":"CindyJS/CindyJS","owner":{"login":"CindyJS","id":14181218,"avatar_url":"https://avatars.githubusercontent.com/u/14181218?v=3","gravatar_id":"","url":"https://api.github.com/users/CindyJS","html_url":"https://github.com/CindyJS","followers_url":"https://api.github.com/users/CindyJS/followers","following_url":"https://api.github.com/users/CindyJS/following{/other_user}","gists_url":"https://api.github.com/users/CindyJS/gists{/gist_id}","starred_url":"https://api.github.com/users/CindyJS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CindyJS/subscriptions","organizations_url":"https://api.github.com/users/CindyJS/orgs","repos_url":"https://api.github.com/users/CindyJS/repos","events_url":"https://api.github.com/users/CindyJS/events{/privacy}","received_events_url":"https://api.github.com/users/CindyJS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CindyJS/CindyJS","description":"A JavaScript framework for interactive (mathematical) content","fork":false,"url":"https://api.github.com/repos/CindyJS/CindyJS","forks_url":"https://api.github.com/repos/CindyJS/CindyJS/forks","keys_url":"https://api.github.com/repos/CindyJS/CindyJS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CindyJS/CindyJS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CindyJS/CindyJS/teams","hooks_url":"https://api.github.com/repos/CindyJS/CindyJS/hooks","issue_events_url":"https://api.github.com/repos/CindyJS/CindyJS/issues/events{/number}","events_url":"https://api.github.com/repos/CindyJS/CindyJS/events","assignees_url":"https://api.github.com/repos/CindyJS/CindyJS/assignees{/user}","branches_url":"https://api.github.com/repos/CindyJS/CindyJS/branches{/branch}","tags_url":"https://api.github.com/repos/CindyJS/CindyJS/tags","blobs_url":"https://api.github.com/repos/CindyJS/CindyJS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CindyJS/CindyJS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CindyJS/CindyJS/git/refs{/sha}","trees_url":"https://api.github.com/repos/CindyJS/CindyJS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CindyJS/CindyJS/statuses/{sha}","languages_url":"https://api.github.com/repos/CindyJS/CindyJS/languages","stargazers_url":"https://api.github.com/repos/CindyJS/CindyJS/stargazers","contributors_url":"https://api.github.com/repos/CindyJS/CindyJS/contributors","subscribers_url":"https://api.github.com/repos/CindyJS/CindyJS/subscribers","subscription_url":"https://api.github.com/repos/CindyJS/CindyJS/subscription","commits_url":"https://api.github.com/repos/CindyJS/CindyJS/commits{/sha}","git_commits_url":"https://api.github.com/repos/CindyJS/CindyJS/git/commits{/sha}","comments_url":"https://api.github.com/repos/CindyJS/CindyJS/comments{/number}","issue_comment_url":"https://api.github.com/repos/CindyJS/CindyJS/issues/comments{/number}","contents_url":"https://api.github.com/repos/CindyJS/CindyJS/contents/{+path}","compare_url":"https://api.github.com/repos/CindyJS/CindyJS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CindyJS/CindyJS/merges","archive_url":"https://api.github.com/repos/CindyJS/CindyJS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CindyJS/CindyJS/downloads","issues_url":"https://api.github.com/repos/CindyJS/CindyJS/issues{/number}","pulls_url":"https://api.github.com/repos/CindyJS/CindyJS/pulls{/number}","milestones_url":"https://api.github.com/repos/CindyJS/CindyJS/milestones{/number}","notifications_url":"https://api.github.com/repos/CindyJS/CindyJS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CindyJS/CindyJS/labels{/name}","releases_url":"https://api.github.com/repos/CindyJS/CindyJS/releases{/id}","deployments_url":"https://api.github.com/repos/CindyJS/CindyJS/deployments","created_at":"2015-09-08T15:51:32Z","updated_at":"2016-02-28T19:26:40Z","pushed_at":"2016-03-24T08:13:38Z","git_url":"git://github.com/CindyJS/CindyJS.git","ssh_url":"git@github.com:CindyJS/CindyJS.git","clone_url":"https://github.com/CindyJS/CindyJS.git","svn_url":"https://github.com/CindyJS/CindyJS","homepage":null,"size":12317,"stargazers_count":9,"watchers_count":9,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":81,"forks":11,"open_issues":81,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CindyJS/CindyJS/pulls/257"},"html":{"href":"https://github.com/CindyJS/CindyJS/pull/257"},"issue":{"href":"https://api.github.com/repos/CindyJS/CindyJS/issues/257"},"comments":{"href":"https://api.github.com/repos/CindyJS/CindyJS/issues/257/comments"},"review_comments":{"href":"https://api.github.com/repos/CindyJS/CindyJS/pulls/257/comments"},"review_comment":{"href":"https://api.github.com/repos/CindyJS/CindyJS/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CindyJS/CindyJS/pulls/257/commits"},"statuses":{"href":"https://api.github.com/repos/CindyJS/CindyJS/statuses/eb648f4b06dc2ce84e028ba139878439e2933322"}}}}