source: tests/expression.cfa@ 948fdef

ADT arm-eh ast-experimental enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr pthread-emulation qualifiedEnum
Last change on this file since 948fdef was 948fdef, checked in by Peter A. Buhr <pabuhr@…>, 6 years ago

change backquotes identifiers to xxx syntax, change priority of postfix function call

  • Property mode set to 100644
File size: 999 bytes
Line 
1struct S { int i; };
2void ?{}( S & s, int i ) {}
3int ?`mary( int );
4int ?`mary( S );
5[int] ?`mary( [int, int] );
6int jack( int );
7
8int main() {
9 int a[3] = { 0, 0, 0 };
10 S s = { 3 }, * ps = &s;
11 [int] t;
12 * [int] pt = &t;
13 int i = 3, j = 4;
14
15 // operators
16
17 ! i;
18 ~i;
19 +i;
20 -i;
21 *ps;
22 ++ps;
23 --ps;
24 ps++;
25 ps--;
26
27 i+j;
28 i-j;
29 i*j;
30
31 i/j;
32 i%j;
33 i^j;
34 i&j;
35 i|j;
36 i<j;
37 i>j;
38 i=j;
39
40 i==j;
41 i!=j;
42 i<<j;
43 i>>j;
44 i<=j;
45 i>=j;
46 i&&j;
47 i||j;
48 ps->i;
49
50 i*=j;
51 i/=j;
52 i%=j;
53 i+=j;
54 i-=j;
55 i&=j;
56 i|=j;
57 i^=j;
58 i<<=j;
59 i>>=j;
60
61 i?i:j;
62
63 // postfix function call
64
65 (3 + 4)`mary;
66 ({3 + 4;})`mary;
67 [3, 4]`mary;
68 3`mary;
69 a[0]`mary;
70 a[0]`mary`mary;
71 s{0}`mary;
72 jack(3)`mary;
73 s.i`mary;
74 t.0`mary;
75 s.[i]`mary;
76 ps->i`mary;
77 pt->0`mary;
78 ps->[i]`mary;
79 i++`mary;
80 i--`mary;
81 (S){2}`mary;
82 (S)@{2}`mary;
83} // main
Note: See TracBrowser for help on using the repository browser.