b42ffb104159
Port to Tracery
author | Steve Losh <steve@stevelosh.com> |
---|---|
date | Thu, 12 Jan 2017 22:37:47 +0000 |
parents | 2898f6fe4376 |
children | 37d2a6b3aaf0 |
branches/tags | (none) |
files | examples/git-commands.js examples/git-commands.lisp examples/git-man-pages.lisp |
Changes
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/git-commands.js Thu Jan 12 22:37:47 2017 +0000 @@ -0,0 +1,292 @@ +{ + "noun": [ + "binary blob", + "packfile", + "refspec", + "blob", + "branch", + "changeset", + "commit", + "conflicted merge", + "current HEAD", + "file", + "head", + "merge", + "remote", + "object", + "patch", + "ref", + "repository", + "symlink", + "tag", + "tip" + ], + "shell-noun": [ + "binary-blob", + "packfile", + "refspec", + "blob", + "branch", + "changeset", + "commit", + "conflicted-merge", + "current-head", + "file", + "head", + "merge", + "remote", + "object", + "patch", + "ref", + "repository", + "symlink", + "tag", + "tip" + ], + "shell-noun-cap": [ + "BINARY-BLOB", + "PACKFILE", + "REFSPEC", + "BLOB", + "BRANCH", + "CHANGESET", + "COMMIT", + "CONFLICTED-MERGE", + "CURRENT-HEAD", + "FILE", + "HEAD", + "MERGE", + "REMOTE", + "OBJECT", + "PATCH", + "REF", + "REPOSITORY", + "SYMLINK", + "TAG", + "TIP" + ], + "git-location_": [ + "repository", + "index", + "working tree", + "content-addressable filesystem", + "object store", + "reflog", + "current directory", + "current repository", + "current branch", + "checked-out branch", + "upstream repository", + "DAG" + ], + "git-folder_": [ + "refs", + "logs", + "objects", + "hooks", + "HEAD", + "COMMIT_EDITMSG" + ], + "git-folder": [ + ".git/#git-folder_#" + ], + "git-location": [ + "the #git-location_#", + "#git-folder#" + ], + "external-location": [ + "Hacker News", + "Stack Overflow", + "Twitter", + "Reddit", + "Github", + "Gitlab", + "Github's status page", + "/dev/random", + "/dev/urandom", + "your .gitconfig", + "the git man pages", + "the git source code", + "your home directory" + ], + "location": [ + "#git-location#", + "#external-location#" + ], + "action": [ + "[command:bisect][commanding:bisecting]", + "[command:clone][commanding:cloning]", + "[command:commit][commanding:committing]", + "[command:delete][commanding:deleting]", + "[command:display][commanding:displaying]", + "[command:fast-forward][commanding:fast-forwarding]", + "[command:fetch][commanding:fetching]", + "[command:merge][commanding:merging]", + "[command:move][commanding:moving]", + "[command:print][commanding:printing]", + "[command:prune][commanding:pruning]", + "[command:pull][commanding:pulling]", + "[command:push][commanding:pushing]", + "[command:record][commanding:recording]", + "[command:revert][commanding:reverting]", + "[command:remove][commanding:removing]", + "[command:rename][commanding:renaming]", + "[command:reset][commanding:resetting]", + "[command:resolve][commanding:resolving]", + "[command:show][commanding:showing]", + "[command:sign][commanding:signing]", + "[command:simplify][commanding:simplifying]", + "[command:update][commanding:updating]", + "[command:verify][commanding:verifying]" + ], + "action-verb": [ + "bisecting", + "cloning", + "committing", + "deleting", + "displaying", + "fast-forwarding", + "fetching", + "merging", + "moving", + "printing", + "pruning", + "pulling", + "pushing", + "recording", + "reverting", + "removing", + "renaming", + "resetting", + "resolving", + "showing", + "signing", + "simplifying", + "updating", + "verifying" + ], + "refresh": [ + "update", + "reset" + ], + "refreshing": [ + "updating", + "resetting" + ], + "extremum": [ + "newest", + "oldest", + "largest", + "smallest", + "sparsest", + "first", + "last", + "worst", + "simplest", + "best" + ], + "adjective": [ + "merged", + "unmerged", + "symbolic", + "uncommitted", + "signed", + "unsigned", + "big-endian", + "little-endian", + "childless", + "binary" + ], + "age": [ + "newest", + "oldest", + "first", + "last" + ], + "look-for": [ + "search", + "grep", + "bisect", + "filter" + ], + "temporal-adverb": [ + "before", + "after", + "without" + ], + "letter": [ + "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", + "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", + "w", "x", "y", "z" + ], + "short-option_": [ + "-#letter#", + "-#letter# #shell-noun-cap#" + ], + "long-option-with-noun": [ + "--#noun#=<#noun#>" + ], + "set-fucking-noun": [ + "[noun:#shell-noun#]" + ], + "long-option_": [ + "#[#set-fucking-noun#]long-option-with-noun#", + "--#action-verb#", + "--#extremum#", + "--only-#adjective#", + "--only-#shell-noun.s#", + "--#action-verb#=<#shell-noun#>" + ], + "short-option": [ + "#short-option_#", + "\\[#short-option_#\\]" + ], + "long-option": [ + "#long-option_#", + "\\[#long-option_#\\]" + ], + "short-options": [ + "#short-option#", + "#short-option# #short-option#" + ], + "options": [ + "#long-option#", + "#short-options#", + "#short-options# #long-option#", + "#long-option# #short-options#" + ], + "number": [ + "200", "1733", "1925", "1235", "1478", "1770", "365", "269", "1436", + "1552", "1867", "777", "452", "941", "770", "684", "1405", "1828", + "1982", "705", "994", "1452", "239", "1619", "1303", "260", "137", + "1953", "1123", "1697", "246", "1281", "1243", "1970", "668", "288", + "1387", "1115", "841", "1076", "337", "1539", "273", "888", "1329", + "830", "1739", "753", "1519", "814", "106", "817", "1562", "1047", "69", + "869", "1475", "955", "1699", "1128", "1891", "1425", "571", "654", + "1645", "737", "1353", "325", "1465", "1240", "1102", "1001", "1821", + "4", "1996", "1016", "921", "920", "384", "1440", "1768", "707", "1372", + "1053", "1148", "1173", "1412", "261", "100", "213", "1808", "1937", + "168", "959", "393", "1781", "598", "1602", "454", "1781", "808", "1663" + ], + "description": [ + "#look-for# #location# for the #age# #noun# and #command# it", + "read #number# bytes from #location# and #command# them", + "#command# the #extremum# #noun# in #git-location#", + "#command# #noun.a# #temporal-adverb# #refreshing# #git-location#", + "#command# and push all #adjective# #noun.s# to #location#", + "#command# all #adjective# #noun.s# in #git-location#", + "#command# the #extremum# #noun# and merge it into #git-location#", + "#command# some #noun.s# from a remote", + "#command# two or more #noun.s# and save them to #location#", + "move or #command# #noun.a# in #git-location#", + "rebase #noun.a# onto #location# after #commanding# it", + "#command# and #refresh# #git-location#", + "list, #command#, or delete #noun.s#" + ], + "origin_": [ + "git #command# #options#\n#description.capitalize#" + ], + "origin": [ + "#[#action#]origin_#" + ] +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/git-commands.lisp Thu Jan 12 22:37:47 2017 +0000 @@ -0,0 +1,220 @@ +(in-package :chancery) +(named-readtables:in-readtable :chancery) + +(define-rule noun + "binary blob" + "packfile" + "refspec" + "blob" + "branch" + "changeset" + "commit" + "conflicted merge" + "current HEAD" + "file" + "head" + "merge" + "remote" + "object" + "patch" + "ref" + "repository" + "symlink" + "tag" + "tip" + ) + + +(define-rule git-location% + "repository" + "index" + "working tree" + "content-addressable filesystem" + "object store" + "reflog" + "current directory" + "current repository" + "current branch" + "checked-out branch" + "upstream repository" + "DAG") + +(define-rule git-folder% + "" + "refs" + "logs" + "objects" + "hooks" + "HEAD" + "COMMIT_EDITMSG") + +(define-rule git-folder + (".git/" :. git-folder%)) + +(define-rule git-location + ("the" git-location%) + git-folder) + +(define-rule external-location + "Hacker News" + "Stack Overflow" + "Twitter" + "Reddit" + "Github" + "Gitlab" + "Github's status page" + "/dev/random" + "/dev/urandom" + "your .gitconfig" + "the git man pages" + "the git source code" + "your home directory") + +(define-rule location + git-location + external-location) + + +(define-rule action + (list "bisect" "bisecting") + (list "clone" "cloning") + (list "commit" "committing") + (list "delete" "deleting") + (list "display" "displaying") + (list "fast-forward" "fast-forwarding") + (list "fetch" "fetching") + (list "merge" "merging") + (list "move" "moving") + (list "print" "printing") + (list "prune" "pruning") + (list "pull" "pulling") + (list "push" "pushing") + (list "record" "recording") + (list "revert" "reverting") + (list "remove" "removing") + (list "rename" "renaming") + (list "reset" "resetting") + (list "resolve" "resolving") + (list "show" "showing") + (list "sign" "signing") + (list "simplify" "simplifying") + (list "update" "updating") + (list "verify" "verifying") + ) + +(defun action-verb () + (first (action))) + + +(define-rule refresh + "update" + "reset") + +(define-rule refreshing + "updating" + "resetting") + + +(define-rule extremum + "newest" + "oldest" + "largest" + "smallest" + "sparsest" + "first" + "last" + "worst" + "simplest" + "best") + +(define-rule adjective + "merged" + "unmerged" + "symbolic" + "uncommitted" + "signed" + "unsigned" + "big-endian" + "little-endian" + "childless" + "binary" + ) + + +(define-rule age + "newest" + "oldest" + "first" + "last") + +(define-rule look-for + "search" + "grep" + "bisect" + "filter") + +(define-rule temporal-adverb + "before" + "after" + "without") + + +(defun letter () + (random-elt "abcdefghijklmnopqrstuvwxyz")) + +(defun shellify (str) + (string-downcase (substitute #\- #\space str))) + +(define-rule short-option% + ("-" :. letter) + ("-" :. letter [noun shellify string-upcase])) + +(define-rule long-option% + (bind ((noun [noun shellify])) + ("--" :. noun :. "=<" :. noun :. ">")) + ("--" :. action-verb) + ("--" :. extremum) + ("--only-" :. adjective) + ("--only-" :. [noun shellify s]) + ("--" :. action-verb :. "=<" :. [noun shellify] :. ">")) + +(define-rule short-option + short-option% + ("[" :. short-option% :. "]")) + +(define-rule long-option + long-option% + ("[" :. long-option% :. "]")) + +(define-rule short-options + short-option + (short-option short-option)) + +(define-rule options + long-option + short-options + (short-options long-option) + (long-option short-options)) + + +(define-rule description + (look-for location "for the" age noun "and" command "it") + ("read" (eval (+ 2 (random 2000))) "bytes from" location "and" command "them") + (command "the" extremum noun "in" git-location) + (command [noun a] temporal-adverb refreshing git-location) + (command "and push all" adjective [noun s] "to" location) + (command "all" adjective [noun s] "in" git-location) + (command "the" extremum "and merge it into" git-location) + (command "some" [noun s] "from a remote") + (command "two or more" [noun s] "and save them to" location) + ("move or" command [noun a] "in" git-location) + ("rebase" [noun a] "onto" location "after" commanding "it") + (command "and" refresh git-location) + ("list," command :. ", or delete" [noun s])) + + +(define-rule entry + (bind (((command commanding) action)) + ("git" command options #\newline :. [description cap]))) + +
--- a/examples/git-man-pages.lisp Thu Jan 12 16:28:29 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,220 +0,0 @@ -(in-package :chancery) -(named-readtables:in-readtable :chancery) - -(define-rule noun - "binary blob" - "packfile" - "refspec" - "blob" - "branch" - "changeset" - "commit" - "conflicted merge" - "current HEAD" - "file" - "head" - "merge" - "remote" - "object" - "patch" - "ref" - "repository" - "symlink" - "tag" - "tip" - ) - - -(define-rule git-location% - "repository" - "index" - "working tree" - "content-addressable filesystem" - "object store" - "reflog" - "current directory" - "current repository" - "current branch" - "checked-out branch" - "upstream repository" - "DAG") - -(define-rule git-folder% - "" - "refs" - "logs" - "objects" - "hooks" - "HEAD" - "COMMIT_EDITMSG") - -(define-rule git-folder - (".git/" :. git-folder%)) - -(define-rule git-location - ("the" git-location%) - git-folder) - -(define-rule external-location - "Hacker News" - "Stack Overflow" - "Twitter" - "Reddit" - "Github" - "Gitlab" - "Github's status page" - "/dev/random" - "/dev/urandom" - "your .gitconfig" - "the git man pages" - "the git source code" - "your home directory") - -(define-rule location - git-location - external-location) - - -(define-rule action - (list "bisect" "bisecting") - (list "clone" "cloning") - (list "commit" "committing") - (list "delete" "deleting") - (list "display" "displaying") - (list "fast-forward" "fast-forwarding") - (list "fetch" "fetching") - (list "merge" "merging") - (list "move" "moving") - (list "print" "printing") - (list "prune" "pruning") - (list "pull" "pulling") - (list "push" "pushing") - (list "record" "recording") - (list "revert" "reverting") - (list "remove" "removing") - (list "rename" "renaming") - (list "reset" "resetting") - (list "resolve" "resolving") - (list "show" "showing") - (list "sign" "signing") - (list "simplify" "simplifying") - (list "update" "updating") - (list "verify" "verifying") - ) - -(defun action-verb () - (first (action))) - - -(define-rule refresh - "update" - "reset") - -(define-rule refreshing - "updating" - "resetting") - - -(define-rule extremum - "newest" - "oldest" - "largest" - "smallest" - "sparsest" - "first" - "last" - "worst" - "simplest" - "best") - -(define-rule adjective - "merged" - "unmerged" - "symbolic" - "uncommitted" - "signed" - "unsigned" - "big-endian" - "little-endian" - "childless" - "binary" - ) - - -(define-rule age - "newest" - "oldest" - "first" - "last") - -(define-rule look-for - "search" - "grep" - "bisect" - "filter") - -(define-rule temporal-adverb - "before" - "after" - "without") - - -(defun letter () - (random-elt "abcdefghijklmnopqrstuvwxyz")) - -(defun shellify (str) - (string-downcase (substitute #\- #\space str))) - -(define-rule short-option% - ("-" :. letter) - ("-" :. letter [noun shellify string-upcase])) - -(define-rule long-option% - (bind ((noun [noun shellify])) - ("--" :. noun :. "=<" :. noun :. ">")) - ("--" :. action-verb) - ("--" :. extremum) - ("--only-" :. adjective) - ("--only-" :. [noun shellify s]) - ("--" :. action-verb :. "=<" :. [noun shellify] :. ">")) - -(define-rule short-option - short-option% - ("[" :. short-option% :. "]")) - -(define-rule long-option - long-option% - ("[" :. long-option% :. "]")) - -(define-rule short-options - short-option - (short-option short-option)) - -(define-rule options - long-option - short-options - (short-options long-option) - (long-option short-options)) - - -(define-rule description - (look-for location "for the" age noun "and" command "it") - ("read" (eval (+ 2 (random 2000))) "bytes from" location "and" command "them") - (command "the" extremum noun "in" git-location) - (command [noun a] temporal-adverb refreshing git-location) - (command "and push all" adjective [noun s] "to" location) - (command "all" adjective [noun s] "in" git-location) - (command "the" extremum "and merge it into" git-location) - (command "some" [noun s] "from a remote") - (command "two or more" [noun s] "and save them to" location) - ("move or" command [noun a] "in" git-location) - ("rebase" [noun a] "onto" location "after" commanding "it") - (command "and" refresh git-location) - ("list," command :. ", or delete" [noun s])) - - -(define-rule entry - (bind (((command commanding) action)) - ("git" command options #\newline :. [description cap]))) - -