Skip to content

Implicit Multiplication

davedelong edited this page Sep 27, 2011 · 4 revisions

The parser recognizes implicit multiplication. For example, we can write 3(4) and understand that the answer should be 12. Implicit multiplication is applied when a number, variable, or closing parenthesis are followed by either a number, variable, function, or opening parenthesis.

Implicit multiplication is quite simple to recognize. We only need 2 tokens in order to recognize it:

Previous Token Current Token Inject Multiplier?
number number yes
operator no
variable yes
function yes
( yes
operator number no
operator no
variable no
function no
( no
variable number yes
operator no
variable yes
function yes
( yes
function number no
operator no
variable no
function no
( no
) number yes
operator no
variable yes
function yes
( yes

Clone this wiki locally