Based on notation from Geometric Algebra for Computer Science and targeting versor.js.
Test out the grammar and export a parser at the PEG.js Online Version.
Outer Product
e1
e1^e2
e1^e2^e3
(e1^e2)^e3
Inner Product
e1.e1
Geometric Product
e1 e2
Here's a version with operator precedence and some tweaks to the operator symbols:
op
= geomprod
geomprod
= left:innerprod "*" right:geomprod { return left + ".gp(" + right + ")"; }
/ innerprod
innerprod
= left:outerprod "<<" right:innerprod { return left + ".ip(" + right + ")"; }
/ outerprod
outerprod
= left:primary "^" right:outerprod { return left + ".op(" + right + ")"; }
/ primary
primary
= blade
/ "(" op:op ")" { return op; }
blade "blade"
= chars:[a-zA-Z0-9]+ { return chars.join(""); }