Ethan Ward's Project Blog

I have made some progress with the syntax parsing function, and this will outline my current approach to the problem.

The following is a BNF description of my approach.

expr -> comp

comp -> "m"oper | oper | "m""("expr")"

oper -> term OP expr | term

term -> ID

"m" denotes the character representing my complement operator.

"(" and ")" represent parentheses.

My operators which could appear in place of "OP" all require two arguments, unlike complement. I am using "u", "n", and "f" to denote union, intersection, and difference respectively in my backend. There is no space between them in my code, but it helps readability.

My sets are represented as "ID", with possible values of "A", "B", "C", "D", and "E".

I definitely need a second opinion on this, but it is enough to design the rest of my functions around.