See http://www.webber-labs.com/wp-content/uploads/2015/08/mpl-03.pdf#page=2 G1: <subexp> ::= a | b | c | <subexp> - <subexp> G2: <subexp> ::= <var> - <subexp> | <var> <var> :: = a | b | a G3: <subexp> ::= <subexp> - <var> | <var> <var> :: = a | b | c See http://www.webber-labs.com/wp-content/uploads/2015/08/mpl-03.pdf#page=10 G4: <exp> ::= <exp> + <exp> | <exp> * <exp> | ( <exp> ) | a | b | c See http://www.webber-labs.com/wp-content/uploads/2015/08/mpl-03.pdf#page=14 G5: <exp> ::= <exp> + <exp> | <mulexp> <mulexp> ::= <mulexp> * <mulexp> | ( <exp> ) | a | b | c G5': <exp> ::= <exp> + <exp> | <mulexp> <mulexp> ::= <mulexp> * <mulexp> | <powexp> <powexp> ::= <powexp> ** <powexp> | ( <exp> ) | a | b | c See http://www.webber-labs.com/wp-content/uploads/2015/08/mpl-03.pdf#page=20 G6: <exp> ::= <exp> + <mulexp> | <mulexp> <mulexp> ::= <mulexp> * rootexp> | <rootexp> <rootexp> ::= ( <exp> ) | a | b | c