27 %token TU8 TU16 TU32 TU64
28 %token TS8 TS16 TS32 TS64
47 program: | program clause
49 clause: { clausebegin(); } probes optpredicate optaction { clauseend(); }
51 optpredicate: | TIF expr { addpred(codegen(exprcheck($2, 1))); }
56 addarg(node(OSYM, getsym("probe")));
60 stats: | stats0 | stats0 ';'
61 stats0: stat | stats0 ';' stat
63 stat: expr { addstat(STATEXPR, exprcheck($1, 0)); }
64 | TPRINT { addstat(STATPRINT); } pelist
65 | TPRINTF { addstat(STATPRINTF); } pelist
71 | '(' elist2 optcomma ')'
74 elist2: arg ',' arg | elist2 ',' arg
75 arg: expr { addarg(exprcheck($1, 0)); }
79 TSYM { $$ = node(OSYM, $1); }
80 | TNUM { $$ = node(ONUM, $1); }
81 | TSTR { $$ = node(OSTR, $1); }
82 | expr '+' expr { $$ = node(OBIN, OPADD, $1, $3); }
83 | expr '-' expr { $$ = node(OBIN, OPSUB, $1, $3); }
84 | expr '*' expr { $$ = node(OBIN, OPMUL, $1, $3); }
85 | expr '/' expr { $$ = node(OBIN, OPDIV, $1, $3); }
86 | expr '%' expr { $$ = node(OBIN, OPMOD, $1, $3); }
87 | expr '&' expr { $$ = node(OBIN, OPAND, $1, $3); }
88 | expr '|' expr { $$ = node(OBIN, OPOR, $1, $3); }
89 | expr '^' expr { $$ = node(OBIN, OPXOR, $1, $3); }
90 | expr TLSL expr { $$ = node(OBIN, OPLSH, $1, $3); }
91 | expr TLSR expr { $$ = node(OBIN, OPRSH, $1, $3); }
92 | expr TEQ expr { $$ = node(OBIN, OPEQ, $1, $3); }
93 | expr TNE expr { $$ = node(OBIN, OPNE, $1, $3); }
94 | expr '<' expr { $$ = node(OBIN, OPLT, $1, $3); }
95 | expr TLE expr { $$ = node(OBIN, OPLE, $1, $3); }
96 | expr '>' expr { $$ = node(OBIN, OPLT, $3, $1); }
97 | expr TGE expr { $$ = node(OBIN, OPLE, $3, $1); }
98 | expr TAND expr { $$ = node(OBIN, OPLAND, $1, $3); }
99 | expr TOR expr { $$ = node(OBIN, OPLOR, $1, $3); }
100 | '-' expr %prec unary { $$ = node(OBIN, OPSUB, node(ONUM, 0LL), $2); }
101 | '~' expr %prec unary { $$ = node(OBIN, OPXNOR, node(ONUM, 0LL), $2); }
102 | '!' expr %prec unary { $$ = node(OLNOT, $2); }
103 | '(' expr ')' { $$ = $2; }
104 | expr '?' expr ':' expr %prec '?' { $$ = node(OTERN, $1, $3, $5); }
105 | '(' type ')' expr %prec castprec { $$ = node(OCAST, $2, $4); }
108 TU8 { $$ = type(TYPINT, 1, 0); }
109 | TS8 { $$ = type(TYPINT, 1, 1); }
110 | TU16 { $$ = type(TYPINT, 2, 0); }
111 | TS16 { $$ = type(TYPINT, 2, 1); }
112 | TU32 { $$ = type(TYPINT, 4, 0); }
113 | TS32 { $$ = type(TYPINT, 4, 1); }
114 | TU64 { $$ = type(TYPINT, 8, 0); }
115 | TS64 { $$ = type(TYPINT, 8, 1); }
116 | TSTRING { $$ = type(TYPSTRING); }
119 TSYM { addprobe($1->name); }
120 | probes ',' TSYM { addprobe($3->name); }