comparison graal/com.oracle.truffle.sl.test/tests/CalcShell.output @ 13821:b16ec83edc73

Documentation and more refactoring of Simple Language
author Christian Wimmer <christian.wimmer@oracle.com>
date Wed, 29 Jan 2014 20:45:43 -0800
parents
children
comparison
equal deleted inserted replaced
13820:20e7727588e8 13821:b16ec83edc73
1 available commands:
2 x: exit
3 c: define the calculation function with the parameters prev, cur, and i
4 prev and cur start with 0; i is the loop variable from 0 to n
5 example: 'return cur + i;' computes the sum of 1 to n
6 example: 'if (i == 0) { return 1; } else { return cur * i; }' computes the factorial of i
7 example: 'if (i <= 2) { return 1; } else { return prev + cur; }' computes the nth Fibonacci number
8 i: define the number of iterations, i.e, the number n in the examples above
9 r: Run the calculation loop often, and print the first and last result
10 t: Run the calculation loop a couple of time, and print timing information for each run
11 h: Print this help message
12
13 cmd>
14 n>
15 cmd>
16 function>
17 cmd>
18 ** first: 3240
19 ** last: 3240
20 cmd>
21 function>
22 cmd>
23 ** first: 23416728348467685
24 ** last: 23416728348467685
25 cmd>
26 n>
27 cmd>
28 ** first: 354224848179261915075
29 ** last: 354224848179261915075
30 cmd>
31 function>
32 cmd>
33 ** first: 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000
34 ** last: 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000
35 cmd>