Extendable Enum like Type?
On 07/18/2019 06:04 AM, Antoon Pardon wrote:
> I am experimenting with writing an Earley Parser. Now I would like to
> have the non-terminals from the grammer I am reading in, be represented
> bye an enum like type. So that if the grammer contains the following
> production: Term -> Term '+' Factor I can reprensent the right hand side
> with a list that gets printed something like the following:
> [<Non_Terminal.Term:1>, '+', <Non_Terminal.Factor:2>] I am a bit at a
> loss right now on how to start. Can someone point me in the right
The basic method is:
from enum import Enum # `from aenum`  if less than Python 3.4
Term = 1
Factor = 2
The docs  also have a lot of information.
Does that answer your question?
 I am the author of Enum, aenum, and the enum34 backport.