{"action":"created","issue":{"url":"https://api.github.com/repos/WebAssembly/design/issues/617","repository_url":"https://api.github.com/repos/WebAssembly/design","labels_url":"https://api.github.com/repos/WebAssembly/design/issues/617/labels{/name}","comments_url":"https://api.github.com/repos/WebAssembly/design/issues/617/comments","events_url":"https://api.github.com/repos/WebAssembly/design/issues/617/events","html_url":"https://github.com/WebAssembly/design/issues/617","id":142027949,"number":617,"title":"An idea of using Cirru syntax as an alternative of text format","user":{"login":"jiyinyiyong","id":449224,"avatar_url":"https://avatars.githubusercontent.com/u/449224?v=3","gravatar_id":"","url":"https://api.github.com/users/jiyinyiyong","html_url":"https://github.com/jiyinyiyong","followers_url":"https://api.github.com/users/jiyinyiyong/followers","following_url":"https://api.github.com/users/jiyinyiyong/following{/other_user}","gists_url":"https://api.github.com/users/jiyinyiyong/gists{/gist_id}","starred_url":"https://api.github.com/users/jiyinyiyong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jiyinyiyong/subscriptions","organizations_url":"https://api.github.com/users/jiyinyiyong/orgs","repos_url":"https://api.github.com/users/jiyinyiyong/repos","events_url":"https://api.github.com/users/jiyinyiyong/events{/privacy}","received_events_url":"https://api.github.com/users/jiyinyiyong/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/WebAssembly/design/labels/text%20format","name":"text format","color":"c5def5"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/WebAssembly/design/milestones/2","html_url":"https://github.com/WebAssembly/design/milestones/MVP","labels_url":"https://api.github.com/repos/WebAssembly/design/milestones/2/labels","id":1138963,"number":2,"title":"MVP","description":"See [here](https://github.com/WebAssembly/design/blob/master/MVP.md) for details.","creator":{"login":"sunfishcode","id":4503403,"avatar_url":"https://avatars.githubusercontent.com/u/4503403?v=3","gravatar_id":"","url":"https://api.github.com/users/sunfishcode","html_url":"https://github.com/sunfishcode","followers_url":"https://api.github.com/users/sunfishcode/followers","following_url":"https://api.github.com/users/sunfishcode/following{/other_user}","gists_url":"https://api.github.com/users/sunfishcode/gists{/gist_id}","starred_url":"https://api.github.com/users/sunfishcode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sunfishcode/subscriptions","organizations_url":"https://api.github.com/users/sunfishcode/orgs","repos_url":"https://api.github.com/users/sunfishcode/repos","events_url":"https://api.github.com/users/sunfishcode/events{/privacy}","received_events_url":"https://api.github.com/users/sunfishcode/received_events","type":"User","site_admin":false},"open_issues":47,"closed_issues":87,"state":"open","created_at":"2015-05-29T00:13:49Z","updated_at":"2016-07-25T23:00:04Z","due_on":null,"closed_at":null},"comments":33,"created_at":"2016-03-19T05:26:05Z","updated_at":"2016-07-26T01:10:01Z","closed_at":null,"body":"...I'm just thinking from the syntax side, but not being experienced in compiler. I will just discuss on the syntax side.\r\n\r\nI made a video to demonstrate the main ideas behind Cirru:\r\nhttps://www.youtube.com/watch?v=1ShYO_A8g-0 (14mins)\r\n\r\nShort version:\r\n\r\n* Cirru is trying to build a syntax tree that we can edit directly\r\n* that syntax tree has a text syntax, with parser and formatter\r\n* that text syntax is based on indentations\r\n* I've been thinking about it for several years and have been using it for months\r\n\r\nFor Cirru code like this:\r\n```cirru\r\ndefn add2 (x y) (+ x y)\r\n```\r\nit is equivalent to a piece of data in JSON:\r\n```json\r\n[\"defn\", \"add2\", [\"x\", \"y\"], [\"+\", \"x\", \"y\"]]\r\n```\r\nonce you get JSON you are free to make an DOM editor or simply render to HTML/CSS:\r\n![image](https://cloud.githubusercontent.com/assets/449224/13896673/f185549e-edcf-11e5-8bf8-53aa9cf8a70a.png)\r\nand also it can be turned back to Cirru code as you want.\r\n\r\nCheck these links if you need details.\r\nhttp://cirru.org/\r\nhttps://github.com/Cirru/\r\nhttps://twitter.com/cirrulang\r\nhttps://github.com/Cirru/cirru-wasm-ast (mostly based on @indutny 's work)\r\nhttps://github.com/Cirru/cirru-wasm-cli\r\n\r\nFrom my side I got some experience using Cirru:\r\n\r\nPros\r\n\r\n* Preciously we are programming by manipulating text files, we all say it's about AST, which is a tree, but we need the help of text syntax to do it. Some languages pushed syntax even further and it becomes hard for newcomers to pick up. Cirru is giving more possibilities. I mean we can manipulate the syntax tree directly now.\r\n\r\n* Cirru syntax is simple. It's based on indentations and reduced the usage of parentheses a lot.\r\n\r\n* Cirru syntax is flexible. When recovered from binary files, it can be turned into serveral styles of text form, such as \"smart folding look like human wrote it\", \"expression unfolded for the purpose of add break points\", \"tree view for a better user interface\", etc.\r\n\r\n* I've been generating my JavaScript code and ClojureScript code in Cirru for many months, the syntax is quite handy now.\r\n\r\nCons\r\n\r\n* People hate to learn one more syntax, what's worse, it's different from C, Java or Python.\r\n\r\n* String syntax in Cirru can be confusing according to my experience introducing Cirru to others. Because Cirru was originally designed as a tree editor and people does not quote marks in a tree editor.\r\n\r\n* After Cirru code is parsed into a tree, we need another step to turn that tree into an AST. I'm not quite clear about how compilers will handle this. So I'm not sure it's good or bad.\r\n\r\n* I think we don't have very much experience programming with a tree rather than a text file. Our toolchains are mostly based on text files.\r\n\r\nEven if we don't want the graphical part of CIrru, we can still try its text syntax. It's basic Lisp in indentations(with string syntax a bit strange):\r\nhttps://gist.github.com/jiyinyiyong/0fc58e2ed7c641973d9b\r\n\r\n```cirru\r\nmodule\r\n  export :even $even\r\n  export \"odd\" $odd\r\n\r\n  func $even (param $n i32) (result i32)\r\n    if (i32.eq (get_local $n) (i32.const 0))\r\n      i32.const 1\r\n      call $odd (i32.sub (get_local $n) (i32.const 1))\r\n\r\n  func $odd (param $n i32) (result i32)\r\n    store_global $scratch (get_local $n)\r\n    if (i32.eq (get_local $n) (i32.const 0))\r\n      i32.const 0\r\n      call $even (i32.sub (get_local $n) (i32.const 1))\r\n\r\n  global $scratch i32\r\n```\r\n\r\nI'm a big fan of Lisp(mainly Clojure), but dislike the parentheses in Lisp. So this is my idea to fix it and that in WebAssembly."},"comment":{"url":"https://api.github.com/repos/WebAssembly/design/issues/comments/235133760","html_url":"https://github.com/WebAssembly/design/issues/617#issuecomment-235133760","issue_url":"https://api.github.com/repos/WebAssembly/design/issues/617","id":235133760,"user":{"login":"yurydelendik","id":1523410,"avatar_url":"https://avatars.githubusercontent.com/u/1523410?v=3","gravatar_id":"","url":"https://api.github.com/users/yurydelendik","html_url":"https://github.com/yurydelendik","followers_url":"https://api.github.com/users/yurydelendik/followers","following_url":"https://api.github.com/users/yurydelendik/following{/other_user}","gists_url":"https://api.github.com/users/yurydelendik/gists{/gist_id}","starred_url":"https://api.github.com/users/yurydelendik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yurydelendik/subscriptions","organizations_url":"https://api.github.com/users/yurydelendik/orgs","repos_url":"https://api.github.com/users/yurydelendik/repos","events_url":"https://api.github.com/users/yurydelendik/events{/privacy}","received_events_url":"https://api.github.com/users/yurydelendik/received_events","type":"User","site_admin":false},"created_at":"2016-07-26T01:10:01Z","updated_at":"2016-07-26T01:10:01Z","body":"The @sunfishcode's strawman proposal is not LES-based (at least not yet) that's why I don't really understand why this is mentioned in the examples comments."}}
{"actor":{"display_login":"yurydelendik"}}