qorf / quorum-language

The primary repository for the Quorum Programming Language
BSD 3-Clause "New" or "Revised" License
12 stars 6 forks source link

Unexpected error message #106

Closed hpablo closed 6 months ago

hpablo commented 7 months ago

When exploring the first Activity in this web page introducing types, I tried

a = 10
output b

and got

I did not understand:
Line 2, Column 8: Could not find the variable b

which is fine. But then tried

a = 10
output 1b

and got

I did not understand:
Line 1, Column 1: I noticed that the class Main.quorum was specified as the starting point for this program, but it does not have an action named Main. 

which I'd think a novice will find unexpected, and difficult to understand.

andreas-stefik commented 6 months ago

Wild. That sure seems like it would be difficult for a novice to understand for me too. I'll take a look and see if I can't figure out why it's choosing that message.

andreas-stefik commented 6 months ago

Well look at that. It really does do this. Well, it's confirmed. I'll see if I can't get rid of this one.

andreas-stefik commented 6 months ago

Well, I still have to run the test suite and push it up, but I think I've fixed it. It looks like there were instances where it was actually token splitting, which is correct in this case, but because of that it thought there was an expression and a statement. That's actually correct as well, but under that very specific instance, if the compiler generated the correct message, it would sometimes throw it away and not give it to the user, which led to a fallback. There was another bug in there where it wouldn't tell you which token was the problem, so I fixed that too.

The new message is as follows:

The text ended when trying to process an identifier named 'b.' You could try calling an action with parens (), setting it to a value with = (equals) or other options.

Personally I think that's still a bit unclear, but I think at this particular spot in the compiler it probably couldn't tell you much more than that. It's also consistent with other messages at least and 8th grade reading level (I just checked). That said, I'm happy to take suggestions.

In any case, thanks so much for sending this to us! I didn't know this bug existed and it really was pretty confusing. I'll try to have this come out in the next patch, online and off.

andreas-stefik commented 6 months ago

Here's the commit with the fix:

Fix to Bug #106