Задача 3: Поддержка переменных, организация их хранения

<Digit> ::= [0-9]
<UnsignedInteger> ::= "0" | [1-9] <Digit>*
<Integer> ::= "-"? <UnsignedInteger> | [a-z]
<Multiplier> ::= <Integer> | "-" <Multiplier> | "(" <Expression> ")" | "=" <Expression>
<Term> ::= <Multiplier> ( "*" <Multiplier> | "/" <Multiplier> | "=" <Expression>  )*
<Expression> ::= <Term> ( "+" <Term> | "-" <Term> )*

Решение на гитхабе

<Digit> ::= [0-9]
<UnsignedInteger> ::= "0" | [1-9] <Digit>*
<Integer> ::= "-"? <UnsignedInteger>
<Variable> ::= [a-z]
<Multiplier> ::= <Integer> | "-" <Multiplier> | "(" <Expression> ")" | <Variable>
<Term> ::= <Multiplier> ( "*" <Multiplier> | "/" <Multiplier> )*
<Expression> ::= <Variable> "=" <Expression> | <Term> ( "+" <Term> | "-" <Term> )*