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,51 @@
|
||||
const LIMIT = 20
|
||||
|
||||
func is_prime(n: int): bool {
|
||||
if n < 2 {
|
||||
return false
|
||||
}
|
||||
var d = 2
|
||||
for d * d <= n {
|
||||
if n % d == 0 {
|
||||
return false
|
||||
}
|
||||
d += 1
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func main() {
|
||||
var sum = 0
|
||||
for i in 1..11 {
|
||||
sum += i
|
||||
}
|
||||
print("sum 1..10 =", sum)
|
||||
|
||||
print("evens:")
|
||||
for i in 0..LIMIT step 2 {
|
||||
print(i)
|
||||
}
|
||||
|
||||
print("countdown:")
|
||||
for i in 5..0 step -1 {
|
||||
print(i)
|
||||
}
|
||||
|
||||
var primes = ""
|
||||
for n in 0..LIMIT {
|
||||
if !is_prime(n) {
|
||||
continue
|
||||
}
|
||||
primes += "{n} "
|
||||
}
|
||||
print("primes:", primes)
|
||||
|
||||
var k = 0
|
||||
for {
|
||||
k += 1
|
||||
if k == 3 {
|
||||
break
|
||||
}
|
||||
}
|
||||
print("k =", k)
|
||||
}
|
||||
Reference in new issue
Block a user