You are viewing a single comment's thread from:

RE: Writing a simple Compiler on my own - Combine Flex and Bison

in #utopian-io4 years ago

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?

Coin Marketplace

STEEM 0.27
TRX 0.11
JST 0.030
BTC 70853.78
ETH 3811.42
USDT 1.00
SBD 3.43