You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
// pos is a helper function used to track the position in the lexer.
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:
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: