{"action":"created","issue":{"url":"https://api.github.com/repos/AvailLang/Avail/issues/106","labels_url":"https://api.github.com/repos/AvailLang/Avail/issues/106/labels{/name}","comments_url":"https://api.github.com/repos/AvailLang/Avail/issues/106/comments","events_url":"https://api.github.com/repos/AvailLang/Avail/issues/106/events","html_url":"https://github.com/AvailLang/Avail/issues/106","id":95865675,"number":106,"title":"Create a backquote notation for creating phrases","user":{"login":"toddATavail","id":7750049,"avatar_url":"https://avatars.githubusercontent.com/u/7750049?v=3","gravatar_id":"","url":"https://api.github.com/users/toddATavail","html_url":"https://github.com/toddATavail","followers_url":"https://api.github.com/users/toddATavail/followers","following_url":"https://api.github.com/users/toddATavail/following{/other_user}","gists_url":"https://api.github.com/users/toddATavail/gists{/gist_id}","starred_url":"https://api.github.com/users/toddATavail/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toddATavail/subscriptions","organizations_url":"https://api.github.com/users/toddATavail/orgs","repos_url":"https://api.github.com/users/toddATavail/repos","events_url":"https://api.github.com/users/toddATavail/events{/privacy}","received_events_url":"https://api.github.com/users/toddATavail/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/AvailLang/Avail/labels/C:%20External","name":"C: External","color":"0000aa"},{"url":"https://api.github.com/repos/AvailLang/Avail/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/AvailLang/Avail/labels/P:%20major","name":"P: major","color":"f6f6f6"}],"state":"open","locked":false,"assignee":{"login":"leslieATavail","id":13374392,"avatar_url":"https://avatars.githubusercontent.com/u/13374392?v=3","gravatar_id":"","url":"https://api.github.com/users/leslieATavail","html_url":"https://github.com/leslieATavail","followers_url":"https://api.github.com/users/leslieATavail/followers","following_url":"https://api.github.com/users/leslieATavail/following{/other_user}","gists_url":"https://api.github.com/users/leslieATavail/gists{/gist_id}","starred_url":"https://api.github.com/users/leslieATavail/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leslieATavail/subscriptions","organizations_url":"https://api.github.com/users/leslieATavail/orgs","repos_url":"https://api.github.com/users/leslieATavail/repos","events_url":"https://api.github.com/users/leslieATavail/events{/privacy}","received_events_url":"https://api.github.com/users/leslieATavail/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-07-18T22:46:13Z","updated_at":"2015-07-18T22:46:14Z","closed_at":null,"body":"**Reported by mark on 14 Mar 2015 20:02 UTC**\nThe current notation for constructing phrases is fine for one-by-one phrases, but large compositions of phrases look awkward.  Perhaps we could take a page from Lisp and introduce back-quoting as a technique.  Say we have \"`_!`\" to capture a phrase, and \"``_!``\" (or something like that) to specify a section of the parse tree containing back-quoted content.  We could write:\r\n\r\nMacro \"While_do_\" is\r\n[: phrase=>boolean,\r\n\tbody : block phrase=>top\r\n|\r\n\t\r\n\t\t[\r\n\t\t\t$here;\r\n\t\t\tIf cond then [\r\n\t\t\t\tbody();\r\n\t\t\t\tRestart here\r\n\t\t\t](\r\n\tcond);\r\n\t\t]()\r\n\t\r\n];\r\n\r\nIn this example, the \"While_do_\" macro will return a phrase that at runtime will send \"_(_,)\" with no arguments to some function (so that it can do looping).  The function will be call-site specific, using the passed phrases cond and body at the call site.  But most of the block node (that yields the function) is boiler-plate.  We have to construct the function application send phrase, a block phrase, a label declaration phrase (with a suitable token for \"here\"), the send of \"If_then_\", the send phrase for invoking the body, the send of \"Restart_\", and probably a few odds and ends.  What the quote/back-quote technique gives us in this case is the ability to express it directly using Avail's actual grammar, plus a few guillemets.\r\n\r\nThere is still the need for building individual kinds of phrases with the existing constructors, however, but this new mechanism will reduce certain kinds of boilerplate.\r\n\r\nMost likely this will be accomplished with marker nodes.  Here's a tiny sketch:\r\n\r\nMacro \"`_!`\" is\r\n[: phrase=>top\r\n|\r\n\tAnswer a phrase that will yield a phrase that resembles x, but\r\n\twith paths to the backquote markers replaced with subexpressions\r\n\tthat create phrases.  The backquote markers are replaced by\r\n\ttheir content phrase.\r\n](\r\n\tx);\r\n\r\nMacro \"``_!``\" is\r\n[: phrase=>phrase\r\n|\r\n\tbackquote tagged marker phrase for x => (x's semantic type's semantic type)\r\n](\r\n\tx);\r\n"},"comment":{"url":"https://api.github.com/repos/AvailLang/Avail/issues/comments/122602730","html_url":"https://github.com/AvailLang/Avail/issues/106#issuecomment-122602730","issue_url":"https://api.github.com/repos/AvailLang/Avail/issues/106","id":122602730,"user":{"login":"toddATavail","id":7750049,"avatar_url":"https://avatars.githubusercontent.com/u/7750049?v=3","gravatar_id":"","url":"https://api.github.com/users/toddATavail","html_url":"https://github.com/toddATavail","followers_url":"https://api.github.com/users/toddATavail/followers","following_url":"https://api.github.com/users/toddATavail/following{/other_user}","gists_url":"https://api.github.com/users/toddATavail/gists{/gist_id}","starred_url":"https://api.github.com/users/toddATavail/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toddATavail/subscriptions","organizations_url":"https://api.github.com/users/toddATavail/orgs","repos_url":"https://api.github.com/users/toddATavail/repos","events_url":"https://api.github.com/users/toddATavail/events{/privacy}","received_events_url":"https://api.github.com/users/toddATavail/received_events","type":"User","site_admin":false},"created_at":"2015-07-18T22:46:14Z","updated_at":"2015-07-18T22:46:14Z","body":"**Modified by mark on 14 Mar 2015 20:09 UTC**"}}