Dino compiler: language, formatter, language server, docs, editor support

Compiler in Rust (lexer, parser, checker, C codegen), maps, chars,
dino fmt, dino lsp (diagnostics, formatting, outline, definition,
hover, completion, signature help), docs, examples, VS Code/Vim files.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Your NameandClaude Sonnet 5.5 committed 2026-11-07 23:46:12 +01:00
1 parent 3e2779f447
commit eaf9567a36
117 files changed
+19970

No files matched your search

+48
View File
@@ -0,0 +1,48 @@
func parse_digit(c: string): (int, error) {
if c == "0" { return 0, nil }
if c == "1" { return 1, nil }
if c == "2" { return 2, nil }
return error("not a digit: {c}")
}
func add_digits(a: string, b: string): (int, error) {
var x = parse_digit(a)?
var y = parse_digit(b)?
return x + y, nil
}
func check(n: int): error {
if n < 0 {
return error("negative: {n}")
}
return nil
}
func run(): error {
check(5)?
print("5 is fine")
check(-3)?
print("never printed")
return nil
}
func main(): error {
var sum, err = add_digits("1", "2")
if err != nil {
print("unexpected:", err)
} else {
print("sum =", sum)
}
var _, bad = add_digits("1", "x")
if bad != nil {
print("failed:", bad)
}
var ok: error = nil
print("ok is", ok)
run()?
print("not reached")
return nil
}