Well, a parser won't do anything on its own, it will just produce an abstract syntax tree (AST). I believe to fully implement the mathematics order of operations you need to expand the grammar a bit. In that short example I'd expect it (unless I misunderstand this particular syntax) for it to throw an error, as you define two binary operations and pass three numbers. 1 + 2 * 3 + 4
seems like more sensible test input, and yes, it would work completely wrong (it would tell you you have an expression that consists of multiplication of two additions): mul(add(1,2),add(3,4))
An inverted example might work:
program = add
mul = NUM {"*" NUM}
add = mul {"+" mul}
I would expect it to parse 1 * 2 + 3 * 4
into add(mul(1,2),mul(3,4))
. However, as you can see, I had to change the input, as again: you are expecting very rigid thing as an input.
Try to practice with some abstract grammars - creating specific patterns of "p" and "q" (or any other characters), to get more used to quite backward way of thinking required when working with parsers/lexers.