9 [repeat ruby_lang_stmt]
16 | [EX] 'do [IN] [NL] [ruby_statements] [EX] 'end [IN] [NL]
29 [ruby_term] [repeat ruby_expr_extend]
32 define ruby_expr_extend
33 [al_expr_op] [ruby_term]
39 | [id] [repeat ruby_dot_id]
40 | [SPOFF] [id] [repeat ruby_dot_id] '( [SPON] [ruby_args] ')
41 | 'new [ruby_type_decl] [union]
57 'if [ruby_expr] [NL] [IN]
58 [ruby_statements] [EX]
65 [ruby_statements] [EX]
80 redefine al_host_block
81 '{ [NL] [IN] [al_statements] [EX] '} [NL]
82 | '{ [NL] [IN] [ruby_statements] [EX] '} [NL]
85 function clearUnion Type [ruby_type_decl] Id [id]
88 import ArrayInits [ruby_statements]
89 Stmts [repeat ruby_lang_stmt]
91 Id '= 'new Type Union '; Stmts
96 function initDecl1 Id [id] DeclType [al_type_decl]
99 replace [repeat ruby_lang_stmt]
104 function initDecl2 Id [id] DeclType [al_type_decl]
107 replace [repeat ruby_lang_stmt]
112 function initDecl3 Id [id] DeclType [al_type_decl]
115 replace [repeat ruby_lang_stmt]
120 function initDecl4 Id [id] DeclType [al_type_decl]
123 replace [repeat ruby_lang_stmt]
128 function alStmtToRuby1 AlStmt [action_lang_stmt]
130 VarDecl [al_variable_decl]
132 Type [al_type_decl] Id [id] OptUnion [opt union] ';
133 construct RubyType [ruby_type_decl]
135 replace [repeat ruby_lang_stmt]
137 _ [initDecl1 Id Type] [initDecl2 Id Type]
138 [initDecl3 Id Type] [initDecl4 Id Type]
141 function alExprExtendToRuby AlExprExtend [repeat al_expr_extend]
142 deconstruct AlExprExtend
143 Op [al_expr_op] Term [al_term] Rest [repeat al_expr_extend]
144 construct RubyRest [repeat ruby_expr_extend]
145 _ [alExprExtendToRuby Rest]
146 replace [repeat ruby_expr_extend]
151 % Note: this doesn't go into the ( al_expr ) form of al_term.
152 function alExprToRuby AlExpr [al_expr]
154 ALTerm [al_term] AlExprExtend [repeat al_expr_extend]
155 construct RubyExprExtend [repeat ruby_expr_extend]
156 _ [alExprExtendToRuby AlExprExtend]
157 construct Result [opt ruby_expr]
158 ALTerm RubyExprExtend
159 replace [opt ruby_expr]
164 function alStmtToRuby2 AlStmt [action_lang_stmt]
167 construct OptRubyExpr [opt ruby_expr]
168 _ [alExprToRuby AlExpr]
169 deconstruct OptRubyExpr
171 replace [repeat ruby_lang_stmt]
177 replace [repeat ruby_lang_stmt]
178 'do Block [repeat ruby_lang_stmt] 'end
183 function alOptElseRuby AlOptElse [opt al_else]
184 deconstruct AlOptElse
186 AlSubStmt [action_lang_stmt]
187 construct AlSubStmts [repeat action_lang_stmt]
189 construct RubySubStmts [repeat ruby_lang_stmt]
190 _ [alToRuby AlSubStmts]
191 deconstruct RubySubStmts
192 RubySubStmt [ruby_lang_stmt]
193 replace [opt ruby_else]
196 RubySubStmts [liftBlock]
199 function alStmtToRuby3 AlStmt [action_lang_stmt]
201 'if '( AlExpr [al_expr] ')
202 AlSubStmt [action_lang_stmt]
203 AlOptElse [opt al_else]
204 construct OptRubyExpr [opt ruby_expr]
205 _ [alExprToRuby AlExpr]
206 deconstruct OptRubyExpr
208 construct AlSubStmts [repeat action_lang_stmt]
210 construct RubySubStmts [repeat ruby_lang_stmt]
211 _ [alToRuby AlSubStmts]
212 construct OptRubyElse [opt ruby_else]
213 _ [alOptElseRuby AlOptElse]
214 replace [repeat ruby_lang_stmt]
217 RubySubStmts [liftBlock]
222 function alStmtToRuby4a AlStmt [action_lang_stmt]
225 replace [repeat ruby_lang_stmt]
230 function alStmtToRuby4b AlStmt [action_lang_stmt]
232 'prints String [stringlit] ';
233 replace [repeat ruby_lang_stmt]
235 'print '( String ') ';
238 function alStmtToRuby5 AlStmt [action_lang_stmt]
240 '{ AlSubStmts [repeat action_lang_stmt] '}
241 construct RubySubStmts [repeat ruby_lang_stmt]
242 _ [alToRuby AlSubStmts]
243 replace [repeat ruby_lang_stmt]
245 'do RubySubStmts 'end
248 function alStmtToRuby6 AlStmt [action_lang_stmt]
250 RagelStmt [al_ragel_stmt]
251 replace [repeat ruby_lang_stmt]
259 construct BaseId [id]
262 BaseId [unquote CharLit]
263 construct EmptyString [stringlit]
265 construct Repl [stringlit]
266 EmptyString [quote Id]
272 function alToRuby AlStmts [repeat action_lang_stmt]
274 FirstStmt [action_lang_stmt] Rest [repeat action_lang_stmt]
275 construct RubyFirst [repeat ruby_lang_stmt]
277 [alStmtToRuby1 FirstStmt]
278 [alStmtToRuby2 FirstStmt]
279 [alStmtToRuby3 FirstStmt]
280 [alStmtToRuby4a FirstStmt]
281 [alStmtToRuby4b FirstStmt]
282 [alStmtToRuby5 FirstStmt]
283 [alStmtToRuby6 FirstStmt]
285 construct RubyRest [repeat ruby_lang_stmt]
287 replace [repeat ruby_lang_stmt]
289 RubyFirst [. RubyRest]
293 replace [al_host_block]
294 '{ AlStmts [repeat action_lang_stmt] '}
295 construct RubyStmts [repeat ruby_lang_stmt]
301 rule lowercaseMachine
302 replace $ [machine_stmt]
305 'machine Id [tolower] ';
308 function langTransRuby
310 Definitions [repeat action_lang_stmt]
312 Initializations [repeat action_lang_stmt]
314 construct RubyDefinitions [repeat ruby_lang_stmt]
315 _ [alToRuby Definitions]
316 construct RubyInitializations [repeat ruby_lang_stmt]
317 _ [alToRuby Initializations]
318 construct NewRagelDef [ragel_def]
319 RagelDef [actionTransRuby] [lowercaseMachine]
320 import ArrayInits [ruby_statements]
321 ArrayInitStmts [repeat ruby_lang_stmt]
325 ArrayInitStmts [. RubyInitializations]
332 export ArrayInits [ruby_statements]