{"action":"created","issue":{"url":"https://api.github.com/repos/cmcaine/tridactyl/issues/789","repository_url":"https://api.github.com/repos/cmcaine/tridactyl","labels_url":"https://api.github.com/repos/cmcaine/tridactyl/issues/789/labels{/name}","comments_url":"https://api.github.com/repos/cmcaine/tridactyl/issues/789/comments","events_url":"https://api.github.com/repos/cmcaine/tridactyl/issues/789/events","html_url":"https://github.com/cmcaine/tridactyl/issues/789","id":340217832,"node_id":"MDU6SXNzdWUzNDAyMTc4MzI=","number":789,"title":"A parser for the rest of us.","user":{"login":"antonva","id":1540222,"node_id":"MDQ6VXNlcjE1NDAyMjI=","avatar_url":"https://avatars1.githubusercontent.com/u/1540222?v=4","gravatar_id":"","url":"https://api.github.com/users/antonva","html_url":"https://github.com/antonva","followers_url":"https://api.github.com/users/antonva/followers","following_url":"https://api.github.com/users/antonva/following{/other_user}","gists_url":"https://api.github.com/users/antonva/gists{/gist_id}","starred_url":"https://api.github.com/users/antonva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antonva/subscriptions","organizations_url":"https://api.github.com/users/antonva/orgs","repos_url":"https://api.github.com/users/antonva/repos","events_url":"https://api.github.com/users/antonva/events{/privacy}","received_events_url":"https://api.github.com/users/antonva/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-11T12:20:55Z","updated_at":"2018-07-11T12:49:50Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"**A working draft on a formal specification of the `exstr` language.**\r\n***tl;dr*** Making a new parser, am I missing something?\r\n\r\nI've started working on a new parser for tridactyl and alongside researching this, decided to draft\r\na formal specification on the `exstr` as I think it should be based on ~~fights~~ discussions on matrix.\r\n\r\n***Design goals***\r\n * Make it easier to verify and test the would be parser.\r\n * Create a platform for discussion on what the `exstr` should look like. (this issue)\r\n\r\n**Formal specification of the exstr language in EBNF**\r\n```\r\nexstr                ::= [:] [count] excmd [space options_and_args] [space pipe exstr]\r\nexcmd                ::= word (* for clarity *)\r\noptions_and_args     ::= {options | args }+\r\noptions              ::= {option}+\r\noption               ::= shortoption | longoption | clusteredshortoption\r\nclusteredshortoption ::= \"-\" word\r\nshortoption          ::= \"-\" alphanum [space (word | string)]\r\nlongoption           ::= \"--\" word [\"=\" string]\r\nargs                 ::= {word}+\r\nstring               ::= '\"'|\"'\" {word}* '\"'|\"'\" (* Both \"\" and '' are valid as string boundaries*)\r\nword                 ::= {alphanum}+\r\nalphanum             ::= digit | letter\r\nspace                ::= \" \" (* The space character *)\r\npipe                 ::= \"|\" (* The pipe character *)\r\ncount                ::= {digit}+\r\ndigit                ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9\r\nletter               ::= lower | upper\r\nlower                ::= 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\r\nupper                ::= 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\r\n```\r\n\r\n**Things to consider:**\r\n * Clustered short options must be short options that do not take arguments.\r\n * Add \"--\" as an optional \"end of arguments\". The rest of the parsing can then be considered a parser of args and the possible pipe to another exstr.\r\n * lower and upper will need to include non ASCII characters for foreign languages.\r\n * Current specification includes numbers in the word definition. This allows things such as '-2' as a\r\n  shortoption or an excmd called \"2fast3furious\".\r\n\r\n**Points on the grammar:**\r\n * A valid exstr can optionally start with \":\", \"a positive integer\" followed by an \"excmd\"\r\n * \"excmd\" in this case handles both excmds and exaliases.\r\n * \"space\" is the normal space character.\r\n * Options and arguments are position independent.\r\n * An option can be a shortoption, a clustered shortoption or a longoption.\r\n * A longoption can be `--example` `--example=foo` or `--example=\"foo bar baz\"` and `--example='foo bar baz'`.\r\n * A longoption can NOT be `--example foo bar baz` or `--example=foo bar baz`.\r\n * A shortoption can similarly be `-e`, `-e foo` or `-e \"foo bar baz\"`.\r\n * A string is 0 or more words encapsulated by a single quote ' or a double quote \"\r\n   \r\nReading material:\r\n* [gnu style long options](https://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html)\r\n* [posix option standard](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02)\r\n* [time cube](http://timecube.2enp.com/)\r\n"},"comment":{"url":"https://api.github.com/repos/cmcaine/tridactyl/issues/comments/404157134","html_url":"https://github.com/cmcaine/tridactyl/issues/789#issuecomment-404157134","issue_url":"https://api.github.com/repos/cmcaine/tridactyl/issues/789","id":404157134,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNDE1NzEzNA==","user":{"login":"glacambre","id":11534587,"node_id":"MDQ6VXNlcjExNTM0NTg3","avatar_url":"https://avatars2.githubusercontent.com/u/11534587?v=4","gravatar_id":"","url":"https://api.github.com/users/glacambre","html_url":"https://github.com/glacambre","followers_url":"https://api.github.com/users/glacambre/followers","following_url":"https://api.github.com/users/glacambre/following{/other_user}","gists_url":"https://api.github.com/users/glacambre/gists{/gist_id}","starred_url":"https://api.github.com/users/glacambre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glacambre/subscriptions","organizations_url":"https://api.github.com/users/glacambre/orgs","repos_url":"https://api.github.com/users/glacambre/repos","events_url":"https://api.github.com/users/glacambre/events{/privacy}","received_events_url":"https://api.github.com/users/glacambre/received_events","type":"User","site_admin":false},"created_at":"2018-07-11T12:49:50Z","updated_at":"2018-07-11T12:49:50Z","author_association":"CONTRIBUTOR","body":"Sounds good! Here's what I think:\r\n- Would there be disadvantages to using whitespace instead of space (e.g. space, tab and newline)?\r\n- I think it'd be useful to consider having here-documents in order to fix https://github.com/cmcaine/tridactyl/issues/552 .\r\n- We already use [nearley.js](https://github.com/cmcaine/tridactyl/blob/6fc87d9121a6d1a0e41561ad816829f355a339b5/package.json#L23), it might make sense to re-use it for this."}}
{"actor":{"display_login":"glacambre"}}