0

Consider the grammar:

E→E+T/T
T→num.num/num

The grammar generates the expression of + to integer or real. When two integers are added, the resulting type is integer otherwise, it is real.

Give a syntax-directed definition to determine the type of expression. How can I solve this problem? Please can anyone explain me. Thank You!!!

user4221591
  • 2,084
  • 7
  • 34
  • 68
  • 2
    Sounds like homework. What have you done so far? – Felix Kling Dec 30 '16 at 07:24
  • It is not a homework, I was trying to solve this question but can't. Please can you help. – user4221591 Dec 30 '16 at 07:26
  • 1
    Syntax-directed definition **for which parser generator tool**? What are required inputs and outputs in this problem? – Kaz Dec 30 '16 at 15:21
  • Of the top of my head it reminds me of how OCaml does it, see: [Why is OCaml's (+) not polymorphic?](http://stackoverflow.com/q/8017172/1243762), e.g. uses both `+` and `+.` – Guy Coder Dec 31 '16 at 17:32

0 Answers0