Grammar for parsing simple mathematical expression
Your grammar will generate mathematical expressions, but you haven't captured the notion of operator precedence. For instance, there are two different ways your grammar can generate the expression $a+a*a$, one having the interpretation we'd write as $a+[a*a]$ and the other having $[a+a]*a$. Using the jargon, we'd say your grammar is ambiguous.

A grammar that avoids this problem is

&lt; expression > ::= &lt; term > + &lt; expression > | &lt; term > - &lt; expression > | &lt; term >

&lt; term > ::= &lt; factor > * &lt; term > | &lt; factor > / &lt; term > | &lt; factor >

&lt; factor > ::= (&lt; expression >) | &lt; float > | &lt; var >

See if you can generate $a+a*a$ in two different ways using your grammar and then try the same thing with this grammar. That should give you an idea of what's going on here.