Designing Better Compiler Diagnostics — Lessons from building Klar
dev.to·2d·
Discuss: DEV
🔍KLEE
Preview
Report Post

I’m building a small experimental language called Klar (formerly Klang) as a way to explore explicit semantics, strict diagnostics, and polyglot tooling. This is not a production-ready language — it’s a design exercise — but along the way I’ve been obsessing over one concrete problem: what makes a compiler error actually useful?

Below is a real example of how Klar currently reports an unresolved symbol error (trimmed for brevity). I’d love feedback on whether this format is too verbose, just right, or missing something important.

Example diagnostic (what the user sees):

[K:E217] UnresolvedSymbol
ERROR (SEMANTIC)
at undefinedVariableExceptionTest.kl:10:12

8 |     }
9 |
10 |     println(total);
|             ^

Cause:
The variable 'total' does not exist

Fix:
Remove it or c...

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help