pegn-spec icon indicating copy to clipboard operation
pegn-spec copied to clipboard

Insignificant Definitions

Open q-uint opened this issue 4 years ago • 2 comments

I would like to open a discussion about the insignificant PEGN definitions such as ScanDef, ClassDef and TokenDef.

https://github.com/pegn/spec/blob/4266ea7a5ae3d6540b534e0d07b91428f0f53485/grammar.pegn#L28-L32

Q: Why would I use ClassDef and TokenDef?

TOKEN <- '?'
class <- '?'
Scan  <- '?'

All the previous definitions are the same. They only have different restrictions:

TokenDef

A sequence of token values. https://github.com/pegn/spec/blob/4266ea7a5ae3d6540b534e0d07b91428f0f53485/grammar.pegn#L37

ClassDef

An alternation of simple values. https://github.com/pegn/spec/blob/4266ea7a5ae3d6540b534e0d07b91428f0f53485/grammar.pegn#L54-L55

ScanDef

Can do anything.

q-uint avatar Feb 17 '21 18:02 q-uint