1.0.3 • Published 4 years ago

slack-reminder-grammar v1.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

Slack Reminder Grammar

Simplified Slack Reminder Grammer to parse /remind commands like

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.