Category : multidimensional-array

I am currently trying to convert my small regular expression engine from C to C++. To discard syntactically incorrect regexes in a compact way, I use a 2D array to define what kinds of tokens are allowed after one another: #define NUMBER_OF_TOKEN_KINDS 15 typedef enum { Literal, Alternator, … } TokenKind; bool grammar_allowed[NUMBER_OF_TOKEN_KINDS][NUMBER_OF_TOKEN_KINDS] = { ..

Read more