After spending a month building my compiler, i've now finished the major part of this project(Chapter 1-8), with only some 'little' optimization work to do...
But I also noticed that most of the method, though describe the panic message in a very straightforward way, did not show enough information to quickly locate the source of bugs.
Examples:
1.thread 'main' (28378370) panicked at ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/koopa-0.0.9/src/ir/builder.rs:309:9:
argument type mismatch <----- I think at least we can the expected type and current type.
2.thread 'main' (28364503) panicked at ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/koopa-0.0.9/src/ir/builder.rs:209:14:
src must be a pointer of array. <----- I think we can show what type is src or what type src points to
I know this is the place where debuggers plays well, we can toggle some breakpoint and swimming in stack to find problem, but some informative warning message do not hurt.
So I am wondering would this project introduce some error handling library like anyhow or thiserror in the future?
Koopa IR and this whole course are very helpful and meaningful to me. I am willing to contribute at this part(Error reporting) in my spare time.
After spending a month building my compiler, i've now finished the major part of this project(Chapter 1-8), with only some 'little' optimization work to do...
But I also noticed that most of the method, though describe the panic message in a very straightforward way, did not show enough information to quickly locate the source of bugs.
Examples:
1.thread 'main' (28378370) panicked at ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/koopa-0.0.9/src/ir/builder.rs:309:9:
argument type mismatch <----- I think at least we can the expected type and current type.
2.thread 'main' (28364503) panicked at ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/koopa-0.0.9/src/ir/builder.rs:209:14:
srcmust be a pointer of array. <----- I think we can show what type issrcor what typesrcpoints toI know this is the place where debuggers plays well, we can toggle some breakpoint and swimming in stack to find problem, but some informative warning message do not hurt.
So I am wondering would this project introduce some error handling library like
anyhoworthiserrorin the future?Koopa IR and this whole course are very helpful and meaningful to me. I am willing to contribute at this part(Error reporting) in my spare time.