2024-01-28 22:46:15 +00:00
|
|
|
================================================================================
|
|
|
|
Fibonacci
|
|
|
|
================================================================================
|
|
|
|
|
|
|
|
fib = (i <int>) <int> {
|
|
|
|
if i <= 1 {
|
|
|
|
1
|
|
|
|
} else {
|
|
|
|
self(i - 1) + self(i - 2)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(root
|
|
|
|
(statement
|
2024-02-16 15:55:15 +00:00
|
|
|
(statement_kind
|
|
|
|
(assignment
|
|
|
|
(identifier)
|
|
|
|
(assignment_operator)
|
|
|
|
(statement
|
|
|
|
(statement_kind
|
|
|
|
(expression
|
|
|
|
(value
|
2024-02-23 04:49:07 +00:00
|
|
|
(anonymous_function
|
2024-02-16 15:55:15 +00:00
|
|
|
(identifier)
|
|
|
|
(type_specification
|
|
|
|
(type))
|
|
|
|
(type_specification
|
|
|
|
(type))
|
|
|
|
(block
|
|
|
|
(statement
|
|
|
|
(statement_kind
|
|
|
|
(if_else
|
|
|
|
(if
|
|
|
|
(expression
|
|
|
|
(logic
|
|
|
|
(expression
|
|
|
|
(identifier))
|
|
|
|
(logic_operator)
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer)))))
|
|
|
|
(block
|
|
|
|
(statement
|
|
|
|
(statement_kind
|
2024-01-28 22:46:15 +00:00
|
|
|
(expression
|
2024-02-16 15:55:15 +00:00
|
|
|
(value
|
|
|
|
(integer)))))))
|
|
|
|
(else
|
|
|
|
(block
|
|
|
|
(statement
|
|
|
|
(statement_kind
|
2024-01-28 22:46:15 +00:00
|
|
|
(expression
|
|
|
|
(math
|
|
|
|
(expression
|
2024-02-16 15:55:15 +00:00
|
|
|
(function_call
|
|
|
|
(function_expression
|
|
|
|
(identifier))
|
|
|
|
(expression
|
|
|
|
(math
|
|
|
|
(expression
|
|
|
|
(identifier))
|
|
|
|
(math_operator)
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer)))))))
|
2024-01-28 22:46:15 +00:00
|
|
|
(math_operator)
|
|
|
|
(expression
|
2024-02-16 15:55:15 +00:00
|
|
|
(function_call
|
|
|
|
(function_expression
|
|
|
|
(identifier))
|
|
|
|
(expression
|
|
|
|
(math
|
|
|
|
(expression
|
|
|
|
(identifier))
|
|
|
|
(math_operator)
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer))))))))))))))))))))))))))
|