slack-reminder-grammar

Simplify Slack /reminder command grammar

Stars
9

Slack Reminder Grammar

Simplified Slack Reminder Grammer to parse /remind commands like

Blog Post

Parsing Slack /remind Command

Examples

npx slack-reminder-grammar "/remind @sibelius work tomorrow"

[
  {
    someoneChannel: { type: 'someone', value: 'sibelius' },
    what: 'work',
    when: 'tomorrow',
  }
]
npx slack-reminder-grammar "/remind #general party next week"

[
  {
    someoneChannel: { type: 'channel', value: 'general' },
    what: 'party',
    when: 'next week',
  }
]

How it works?

We use Nearley to compile our grammar written in Nearley syntax (close to EBNF)

The grammar is described at GrammarReminderSlack

We compile the grammar using nearleyc

Other resources to learn about parsers and Nearley

Parsing Absolutely Anything in Javascript using Earley Algorithm by @gajus is a great start

Is this Turing complete?

No, and Turing completeness are not useful in all domain languages.