jgcmarins / slack-reminder-grammar

Simplify Slack /reminder command grammar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

Simplify Slack /reminder command grammar


Languages

Language:JavaScript 50.1%Language:TypeScript 46.6%Language:Nearley 3.3%