0

I am confused how bison will parse / resolve the conflict in this expression assuming "int" is a type and the first expression is typecasting and the second one is just a plain addition or if "a" is a type alias it is same as first. Assuming that language allows for giving alias names to a existing type.

x = (int)+b => typecast to "int" the "+b"
x = (a)+b => addition expression / typecast to "a" the "+b"

Bison has to know if the identifier in the bracket is a type or variable to be able to resolve it. How does it handle that ?

p s
  • 339
  • 3
  • 6
  • 1
    Does this help? https://stackoverflow.com/questions/27448189/bison-reduce-reduce-conflict-with-casting-and-expression-parentheses – General Grievance May 14 '21 at 12:11
  • Yes ! Sharing of symbol table might work. Flex can output the token identifier or type name once it can read the symbol table. – p s May 14 '21 at 12:26

0 Answers0