You are viewing a single comment's thread from:
RE: Writing a simple Compiler on my own - Combine Flex and Bison
Hello drifter1, great job with this series. I am following all along and have a lot of fun. However, it seems there is a slight error in this article.
Your example program reads at the top: "double val = 2.5", however when I run the parser I get an syntax error in this line and I think I also found he reason why:
bison thinks this is a declaration due to:
"declaration: type names SEMI"
but the production for type or names does not lead to the parsing of an assignment "assignment: reference variable ASSIGN expression SEMI ;" because an "assignment" is a statement but not part of a declaration.
This code works:
int val;
val = 2.5;
but not the combined one. How can we fix this?