0

I am writing a parser that parses mathematical expressions based on a syntax diagram very similar to this one.

I have not found a way to handle a missing multiplication sign (for example in 3(x+y)). Where in the syntax diagram do I have to handle this?

Ben Voigt
  • 277,958
  • 43
  • 419
  • 720
HerpDerpington
  • 3,751
  • 4
  • 27
  • 43

1 Answers1

1

You'd make the * optional in the definition of term.

ASCII diagram:

o-->-->--[factor]->-->--o
    /               \
    \               /
     ---<--[*]--<---
         \     /
          --<--
melpomene
  • 84,125
  • 8
  • 85
  • 148