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:
1 parent
3e2779f447
commit
eaf9567a36
117 files changed
+19970
No files matched your search
@@ -0,0 +1,23 @@
|
||||
// Enums with data, generics, interfaces.
|
||||
enum Shape {
|
||||
Circle(r: f64)
|
||||
Rect(w, h: f64)
|
||||
}
|
||||
|
||||
func area(s: Shape): f64 {
|
||||
return match s {
|
||||
Circle(r) => 3.14159 * r * r
|
||||
Rect(w, h) => w * h
|
||||
}
|
||||
}
|
||||
|
||||
interface Drawable { draw() }
|
||||
|
||||
func draw_all[T: Drawable](items: []T) {
|
||||
for item in items { item.draw() }
|
||||
}
|
||||
|
||||
func max[T: Ordered](a, b: T): T {
|
||||
if a > b { return a }
|
||||
return b
|
||||
}
|
||||
Reference in new issue
Block a user