-
-
Notifications
You must be signed in to change notification settings - Fork 305
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
Dig into line/row numbers in the parser #732
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description:
We currently don't have good position (line/row) information about errors from the parser. We'd like to have that information both from parser errors (an error that occurs during the parsing stage) but we'd also like to have that positional information when it occurs in a later stage, such as type unification, and so on.
To get that information, we need to embed it in each AST node. Figure out how this works in goyacc, and propose an early proof-of-concept. We'll help you morph that from rough code to production polish if needed.
Some information is here:
mgmt/lang/parser/parser.y
Line 1509 in 7777107
More here:
mgmt/lang/parser/parser.y
Line 1483 in 7777107
Design:
You probably want to eventually add a new interface that sets the position of row/col for each AST node, either that, or am embedded struct with the data, or both. Don't worry about how this works right away, but I expect that's where we'll end up.
Minimally-viable:
At a bare minimum, try and get mgmt running with a simple mcl file that shows an obvious type unification error (4 == "foo") type of thing. Then we'll see if we can print the line numbers of those expressions and statements.
Longer term:
We should want to pass the line information into the type unification, so that we can include that information when we error.
Questions?
Ask early and often. Post an early version of the code, even if it doesn't compile or work perfectly. Don't spend tool long without checking-in if you feel lost.
Cheers!
The text was updated successfully, but these errors were encountered: