diff options
Diffstat (limited to 'sample/fib_9_abbr.in')
| -rw-r--r-- | sample/fib_9_abbr.in | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sample/fib_9_abbr.in b/sample/fib_9_abbr.in new file mode 100644 index 0000000..57a8c62 --- /dev/null +++ b/sample/fib_9_abbr.in @@ -0,0 +1,16 @@ +// Fibonacci number + +// Rules +fib(ret) >< (int n) +| n == 0 => ret~0 +| n == 1 => ret~1 +| _ => cnt1 << fib(n-1), cnt2 << fib(n-2), ret << Add(cnt1,cnt2); + + +// Note: Add is implemented as a built-in agent such that: +// Add(ret, int m) ~ (int n) --> ret~(m+n); + +// Nets +ret << fib(9); +ret; + |
