隐式乘法

我一直在尝试建立一个相当简单的数学解析器,并且运行良好。只有我不知道如何进行隐式乘法。

I've been using lark as an lalr parser.

这是大部分语法:

?start: expression

?expression: sub

?sub: plus ("-" plus)*
?plus: times ("+" times)*
?times: divide ("*" divide)*
?divide: power ("/" power)?
?power: unary ("^" unary)*

?unary: positive
      | negative
      | atom

?atom: "(" expression ")"
     | numeric 
     | symbol

positive: "+" unary
negative: "-" unary

?numeric: FLOAT
        | INT

?symbol: WORD

%import common.WORD
%import common.INT
%import common.FLOAT
%import common.WS_INLINE
%ignore WS_INLINE

Just making the "*" in times optional leads to a bunch of issues, like 1 - 1 being interpreted as 1 times -1.

我将如何添加和隐式时间运算符?