Debugging and Diagnostics
Use the compiler as a fast feedback loop before you run the program.
Check
blorp check file.brp parses imports, infers types, checks purity, and reports errors without running the program.
terminal
blorp check src
Formatting
blorp format file.brp normalizes source layout; --check is useful in CI.
terminal
blorp format file.brp
blorp format --check file.brp
Debug:
Normal builds erase debug: blocks. Debug and test builds retain them; approved diagnostics such as debug.log can write to stderr, including from pure functions. Ordinary impure calls are still forbidden inside the block.
import:
debug
func main(args: List[String]) -> Void:
value: Int = 42
debug:
debug.log("value: " + debug.debug_string(value)) -- stderr: value: 42 (debug/test only)
Reading Compiler Errors
Most errors point at the missing case, impure call, or incompatible type that needs the smallest source change.
match status:
Ready: "ready"
-- compiler asks for the other variants
Example
diagnostics.brp
import:
debug
pure func score(value: Int) -> Int:
debug:
debug.log("score: ${value * 2}") -- stderr: score: 42 (debug/test only)
value * 2
func main(args: List[String]) -> Void:
print(score(21).to_string()) -- stdout: 42 (normal and debug builds)
Try it
terminal
blorp check diagnostics.brp
blorp run diagnostics.brp # stdout: 42; no stderr
blorp run --debug diagnostics.brp # stdout: 42; stderr: score: 42