filtrex icon indicating copy to clipboard operation
filtrex copied to clipboard

Add implicit multiplication

Open cshaa opened this issue 4 years ago • 2 comments
trafficstars

Make this:

 a^2 + 2 a b + b^2

parse as this:

  a**2 + 2*a*b + b**2

The implicit multiplication operator can be overloaded (see #30) using options.operators.juxtapos. If you want to disable multiplication by juxtaposition, redefine the operator to throw an error.

cshaa avatar Jun 17 '21 11:06 cshaa

I couldn't figure out the correct grammar for this, but if anybody wants to give it a shot, PRs are always welcome. However, I suspect it would be much easier to implement with a PEG instead of Jison (see #40).

cshaa avatar Jun 17 '21 21:06 cshaa

See this SO answer for a great analysis of the problem.

cshaa avatar Jun 23 '21 00:06 cshaa