12 | [EX] '{ [IN] [NL] [c_statements] [EX] '} [IN] [NL]
15 define c_variable_decl
16 [c_type_decl] [id] [opt union] '; [NL]
29 [c_term] [repeat c_expr_extend]
50 'if '( [c_expr] ') [NL] [IN]
72 redefine al_host_block
73 '{ [NL] [IN] [al_statements] [EX] '} [NL]
74 | '{ [NL] [IN] [c_statements] [EX] '} [NL]
77 redefine cond_action_stmt
78 'action [id] '{ [al_expr] '} [NL]
79 | 'action [id] '{ [c_expr] '} [NL]
84 replace [al_type_decl]
111 function alStmtToC1 AlStmt [action_lang_stmt]
113 VarDecl [al_variable_decl]
115 Type [al_type_decl] Id [id] OptUnion [opt union]';
116 construct CType [c_type_decl]
118 construct Result [c_variable_decl]
119 CType [boolTypes] [ptrTypes] Id OptUnion ';
120 replace [repeat c_lang_stmt]
132 function alExprExtendToC AlExprExtend [repeat al_expr_extend]
133 deconstruct AlExprExtend
134 Op [al_expr_op] Term [al_term] Rest [repeat al_expr_extend]
135 construct RestC [repeat c_expr_extend]
136 _ [alExprExtendToC Rest]
137 replace [repeat c_expr_extend]
139 Op Term [alTermToC] RestC
142 function alExprToC AlExpr [al_expr]
144 ALTerm [al_term] AlExprExtend [repeat al_expr_extend]
145 construct CExprExtend [repeat c_expr_extend]
146 _ [alExprExtendToC AlExprExtend]
147 construct Result [opt c_expr]
148 ALTerm [alTermToC] CExprExtend
151 Result [boolVals1] [boolVals2]
154 function alStmtToC2 AlStmt [action_lang_stmt]
157 construct OptCExpr [opt c_expr]
161 replace [repeat c_lang_stmt]
166 function alOptElseC AlOptElse [opt al_else]
167 deconstruct AlOptElse
169 AlSubStmt [action_lang_stmt]
170 construct AlSubStmts [repeat action_lang_stmt]
172 construct CSubStmts [repeat c_lang_stmt]
174 deconstruct CSubStmts
175 CSubStmt [c_lang_stmt]
182 function alStmtToC3 AlStmt [action_lang_stmt]
184 'if '( AlExpr [al_expr] ')
185 AlSubStmt [action_lang_stmt]
186 AlOptElse [opt al_else]
187 construct OptCExpr [opt c_expr]
191 construct AlSubStmts [repeat action_lang_stmt]
193 construct CSubStmts [repeat c_lang_stmt]
195 deconstruct CSubStmts
196 CSubStmt [c_lang_stmt]
197 construct OptCElse [opt c_else]
198 _ [alOptElseC AlOptElse]
199 replace [repeat c_lang_stmt]
206 function alStmtToC4a AlStmt [action_lang_stmt]
209 replace [repeat c_lang_stmt]
211 'printf '( '"%i" ', Id ');
214 function alStmtToC4b AlStmt [action_lang_stmt]
216 'prints String [stringlit] ';
217 replace [repeat c_lang_stmt]
219 'fputs '( String , 'stdout ');
222 function alStmtToC4c AlStmt [action_lang_stmt]
225 replace [repeat c_lang_stmt]
227 'fwrite '( Id ', '1 ', 'pos ', 'stdout ');
230 function alStmtToC4d AlStmt [action_lang_stmt]
233 replace [repeat c_lang_stmt]
235 'fwrite '( 'tokstart ', '1 ', 'tokend '- 'tokstart ', 'stdout ');
238 function alStmtToC5 AlStmt [action_lang_stmt]
240 '{ AlSubStmts [repeat action_lang_stmt] '}
241 construct CSubStmts [repeat c_lang_stmt]
243 replace [repeat c_lang_stmt]
248 function alStmtToC6 AlStmt [action_lang_stmt]
250 RagelStmt [al_ragel_stmt]
251 replace [repeat c_lang_stmt]
256 function alToC AlStmts [repeat action_lang_stmt]
258 FirstStmt [action_lang_stmt] Rest [repeat action_lang_stmt]
259 construct FirstC [repeat c_lang_stmt]
261 [alStmtToC1 FirstStmt]
262 [alStmtToC2 FirstStmt]
263 [alStmtToC3 FirstStmt]
264 [alStmtToC4a FirstStmt]
265 [alStmtToC4b FirstStmt]
266 [alStmtToC4c FirstStmt]
267 [alStmtToC4d FirstStmt]
268 [alStmtToC5 FirstStmt]
269 [alStmtToC6 FirstStmt]
270 construct RestC [repeat c_lang_stmt]
272 replace [repeat c_lang_stmt]
278 replace [al_host_block]
279 '{ AlStmts [repeat action_lang_stmt] '}
280 construct CStmts [repeat c_lang_stmt]
287 replace [cond_action_stmt]
288 'action Id [id] '{ AlExpr [al_expr] '}
289 construct OptCExpr [opt c_expr]
294 'action Id '{ CExpr '}
299 Definitions [repeat action_lang_stmt]
301 Initializations [repeat action_lang_stmt]
303 construct CDefinitions [repeat c_lang_stmt]
304 _ [alToC Definitions]
305 construct CInitializations [repeat c_lang_stmt]
306 _ [alToC Initializations]
311 RagelDef [actionTransC] [condTransC]