-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decimals and Fractions #61
Comments
A common mis-conception when humans think about lexing is the temptation to look ahead.
and can see the fraction coming along. However, that is because we are cursed From the lexers point of view, it is taking an extremely narrow view of things, So the lexer's view is:
So your original interpretation:
For the second example of
Notice that the lexer doesn't get to the final Notice that this is different to how it would be lexed in C, as C has no concept of |
I think I must be missing something, as based on the worked through example, wouldn't the lexer's response to
I ask as this is currently how my program appears to lex |
Gah - yes, I misread your original text when I quoted it, probably You're right, your original answer doesn't actually follow my derivation So the derivation as I gave it is sufficient to determine it is not a fraction, and then I'll correct my previous comment. |
In the specification you say
Can you clarify how the following sequence should be parsed:
5.5/45
Is the correct way to parse this as 5. then 5/45?
How about the example
5/5.5
Should this be parsed as 5/5 (fraction) and 5 (decimal)
How should a compounded fraction such as 3/5/4 be parsed? Is reading that as 3/5 (fraction) and 4 (decimal) the correct response?
I'm probably over thinking this but wanted to check.
The text was updated successfully, but these errors were encountered: