John
79fda16788
Broke frontend into its own library, "cl-frontend" - Frontend is pretty :D - Included sample fibonacci implementation Deprecated conlang::ast::Visitor in favor of bespoke traits - Rust traits are super cool. - The Interpreter is currently undergoing a major rewrite Added preliminary type-path support to the parser - Currently incomplete: type paths must end in Never..? Pretty printer is now even prettier - conlang::ast now exports all relevant AST nodes, since there are no namespace collisions any more
15 lines
249 B
Common Lisp
15 lines
249 B
Common Lisp
// Calculate Fibonacci numbers
|
|
|
|
fn main() -> i128 {
|
|
print("fib(10): ", fib(10));
|
|
}
|
|
|
|
/// Implements the classic recursive definition of fib()
|
|
fn fib(a: i128) -> i128 {
|
|
if a > 1 {
|
|
fib(a - 1) + fib(a - 2)
|
|
} else {
|
|
1
|
|
}
|
|
}
|