- Generate a table of operators in order of precedence taking note of arity (number of "parameters") and associativity direction (evaluates left to right or right to left).
- Give each row in your table a name (this becomes the rule name).
- For each row generate a rule with a production for each operator in the row. Most such productions will refer to rules for higher precedence rows of the table. Look at the calculator parser examples for hints.
- The first rule (lowest precedence) is likely called something like 'Expression'. The last rule is likely called something like 'Constant'.
In other words, do it much the same way you might for generating a conventional calculator parser. Large parts of the calculator examples can be lifted directly and reused for a vector math calculator.
Give it a go. If you run into specific trouble come back for more advice. When you get it going post it to Cool Uses For Perl.
DWIM is Perl's answer to Gödel