File: fibonacci.pda

package info (click to toggle)
eclipse-platform-debug 4.26-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 17,608 kB
  • sloc: java: 152,715; xml: 5,186; makefile: 5
file content (32 lines) | stat: -rw-r--r-- 276 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
push 6
call fibonacci
output
halt
#
# f(n) = f(n-1) + f(n-2)
# f(0) = 1
# f(1) = 1
#
:fibonacci
var n
pop $n
push $n
branch_not_zero gt0
push 1
return
:gt0
push $n
dec
branch_not_zero gt1
push 1
return
:gt1
push $n
dec
call fibonacci
push $n
dec
dec
call fibonacci
add
return