Mercurial > repos > tabletprog
annotate samples/fib.tp @ 53:9482a0afe07c
Fix whitespace for parens in grammar
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 13 Jul 2012 18:31:32 -0700 |
parents | 9dd370530f69 |
children | 3a169ebb3224 |
rev | line source |
---|---|
10 | 1 #{ |
2 true <- #{ | |
3 if:else <- :self trueblock :elseblock { | |
4 trueblock: | |
5 } | |
6 } | |
7 | |
8 false <- #{ | |
9 if:else <- :self trueblock :elseblock { | |
10 elseblock: | |
11 } | |
12 } | |
13 | |
14 fib <- :n { | |
15 if: n < 2 { | |
16 1 | |
17 } else: { | |
18 (fib: n-1) + (fib: n-2) | |
19 } | |
20 } | |
21 | |
22 main <- { | |
44
9dd370530f69
Fix escape codes in string literals. Don't print out the return value of main method. Fixup fib example to use print: method. Cleanup error handling in compiler slightly
Mike Pavone <pavone@retrodev.com>
parents:
10
diff
changeset
|
23 print: (string: (fib: 30)) . "\n" |
10 | 24 } |
25 | |
26 } |