9 [repeat java_lang_stmt]
14 | [java_variable_decl]
17 | [EX] '{ [IN] [NL] [java_statements] [EX] '} [IN] [NL]
20 define java_variable_decl
21 [java_type_decl] [id] [opt union] '; [NL]
35 [java_term] [repeat java_expr_extend]
38 define java_expr_extend
39 [al_expr_op] [java_term]
44 | [id] [repeat java_dot_id]
45 | [id] [repeat java_dot_id] '( [java_args] ')
46 | 'new [java_type_decl] [union]
47 | 'new [java_type_decl] '( [java_args] ')
63 'if '( [java_expr] ') [NL] [IN]
85 redefine al_host_block
86 '{ [NL] [IN] [al_statements] [EX] '} [NL]
87 | '{ [NL] [IN] [java_statements] [EX] '} [NL]
90 redefine cond_action_stmt
91 'action [id] '{ [al_expr] '} [NL]
92 | 'action [id] '{ [java_expr] '} [NL]
96 function clearUnion Type [java_type_decl] Id [id]
99 import ArrayInits [java_statements]
100 Stmts [repeat java_lang_stmt]
102 Id '= 'new Type Union '; Stmts
108 replace [java_type_decl]
115 replace [al_type_decl]
121 function alStmtToJava1 AlStmt [action_lang_stmt]
123 VarDecl [al_variable_decl]
125 Type [al_type_decl] Id [id] OptUnion [opt union] ';
126 construct JavaType [java_type_decl]
128 construct Result [java_variable_decl]
129 JavaType [boolTypes] [ptrTypes] Id OptUnion [clearUnion JavaType Id] ';
130 replace [repeat java_lang_stmt]
135 function alTermToJava
142 function alExprExtendToJava AlExprExtend [repeat al_expr_extend]
143 deconstruct AlExprExtend
144 Op [al_expr_op] Term [al_term] Rest [repeat al_expr_extend]
145 construct JavaRest [repeat java_expr_extend]
146 _ [alExprExtendToJava Rest]
147 replace [repeat java_expr_extend]
149 Op Term [alTermToJava] JavaRest
152 function alExprToJava AlExpr [al_expr]
154 ALTerm [al_term] AlExprExtend [repeat al_expr_extend]
155 construct JavaExprExtend [repeat java_expr_extend]
156 _ [alExprExtendToJava AlExprExtend]
157 construct Result [opt java_expr]
158 ALTerm [alTermToJava] JavaExprExtend
159 replace [opt java_expr]
164 function alStmtToJava2 AlStmt [action_lang_stmt]
167 construct OptJavaExpr [opt java_expr]
168 _ [alExprToJava AlExpr]
169 deconstruct OptJavaExpr
171 replace [repeat java_lang_stmt]
176 function alOptElseJava AlOptElse [opt al_else]
177 deconstruct AlOptElse
179 AlSubStmt [action_lang_stmt]
180 construct AlSubStmts [repeat action_lang_stmt]
182 construct JavaSubStmts [repeat java_lang_stmt]
183 _ [alToJava AlSubStmts]
184 deconstruct JavaSubStmts
185 JavaSubStmt [java_lang_stmt]
186 replace [opt java_else]
192 function alStmtToJava3 AlStmt [action_lang_stmt]
194 'if '( AlExpr [al_expr] ')
195 AlSubStmt [action_lang_stmt]
196 AlOptElse [opt al_else]
197 construct OptJavaExpr [opt java_expr]
198 _ [alExprToJava AlExpr]
199 deconstruct OptJavaExpr
201 construct AlSubStmts [repeat action_lang_stmt]
203 construct JavaSubStmts [repeat java_lang_stmt]
204 _ [alToJava AlSubStmts]
205 deconstruct JavaSubStmts
206 JavaSubStmt [java_lang_stmt]
207 construct OptJavaElse [opt java_else]
208 _ [alOptElseJava AlOptElse]
209 replace [repeat java_lang_stmt]
216 function alStmtToJava4a AlStmt [action_lang_stmt]
219 replace [repeat java_lang_stmt]
221 'System '. 'out '. 'print '( Id ');
224 function alStmtToJava4b AlStmt [action_lang_stmt]
226 'prints String [stringlit] ';
227 replace [repeat java_lang_stmt]
229 'System '. 'out '. 'print '( String ');
232 function alStmtToJava4c AlStmt [action_lang_stmt]
235 replace [repeat java_lang_stmt]
237 '_s '= 'new 'String '( Id ', '0 ', 'pos ') ';
238 'System '. 'out '. 'print '( '_s ');
241 function alStmtToJava4d AlStmt [action_lang_stmt]
244 replace [repeat java_lang_stmt]
246 '_s '= 'new 'String '( 'data ', 'tokstart ', 'tokend '- 'tokstart ') ';
247 'System '. 'out '. 'print '( '_s ');
250 function alStmtToJava5 AlStmt [action_lang_stmt]
252 '{ AlSubStmts [repeat action_lang_stmt] '}
253 construct JavaSubStmts [repeat java_lang_stmt]
254 _ [alToJava AlSubStmts]
255 replace [repeat java_lang_stmt]
260 function alStmtToJava6 AlStmt [action_lang_stmt]
262 RagelStmt [al_ragel_stmt]
263 replace [repeat java_lang_stmt]
269 function alToJava AlStmts [repeat action_lang_stmt]
271 FirstStmt [action_lang_stmt] Rest [repeat action_lang_stmt]
272 construct JavaFirst [repeat java_lang_stmt]
274 [alStmtToJava1 FirstStmt]
275 [alStmtToJava2 FirstStmt]
276 [alStmtToJava3 FirstStmt]
277 [alStmtToJava4a FirstStmt]
278 [alStmtToJava4b FirstStmt]
279 [alStmtToJava4c FirstStmt]
280 [alStmtToJava4d FirstStmt]
281 [alStmtToJava5 FirstStmt]
282 [alStmtToJava6 FirstStmt]
283 construct JavaRest [repeat java_lang_stmt]
285 replace [repeat java_lang_stmt]
287 JavaFirst [. JavaRest]
291 replace [al_host_block]
292 '{ AlStmts [repeat action_lang_stmt] '}
293 construct JavaStmts [repeat java_lang_stmt]
300 replace [cond_action_stmt]
301 'action Id [id] '{ AlExpr [al_expr] '}
302 construct OptJavaExpr [opt java_expr]
303 _ [alExprToJava AlExpr]
304 deconstruct OptJavaExpr
307 'action Id '{ JavaExpr '}
311 replace $ [machine_stmt]
313 import TXLargs [repeat stringlit]
314 Arg1 [stringlit] _ [repeat stringlit]
315 construct ClassName [id]
318 'machine ClassName ';
321 function langTransJava
323 Definitions [repeat action_lang_stmt]
325 Initializations [repeat action_lang_stmt]
327 construct JavaDefinitions [repeat java_lang_stmt]
328 _ [alToJava Definitions]
329 construct JavaInitializations [repeat java_lang_stmt]
330 _ [alToJava Initializations]
331 construct NewRagelDef [ragel_def]
332 RagelDef [actionTransJava] [condTransJava] [machineName]
333 import ArrayInits [java_statements]
334 ArrayInitStmts [repeat java_lang_stmt]
338 ArrayInitStmts [. JavaInitializations]
345 export ArrayInits [java_statements]