@thorny current I have just sped through implementing comma in my parser... And this explanation might be boring but uhh, I used parser combinator to define it.
For example, I have anu seme parser and I wanted for it to accept commas.
sequence(specificWord("anu"), specificWord("seme"))
I simply added optional(comma()) parser to it.
sequence(optional(comma()), specificWord("anu"), specificWord("seme"))
People might use commas in place of periods, in that case, I simply allow sentences to end in comma:
many(sequence(sentence(), match(/[.,:;!?]/)));
The code is a lot different than this btw. This is just for demonstration
As you can see, I simply defined comma in a very declarative way. I keep saying declarative so I'll explain what it is just so we're on the same page.
Imperative programming means telling your computer what to do; Declarative programming means telling your computer what you want.
Of course that just can't happen, you'll still need make something complicated for it to do something complicated. In my case, all the complexities are hidden away inside the combinator. I haven't really explained how combinators works and I'll explain it some time...