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
  • 269,602
  • 39
  • 394
  • 697
HerpDerpington
  • 3,100
  • 4
  • 24
  • 39

1 Answers1

1

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

ASCII diagram:

o-->-->--[factor]->-->--o
    /               \
    \               /
     ---<--[*]--<---
         \     /
          --<--
melpomene
  • 81,915
  • 7
  • 76
  • 137