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] ')
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 initDecl1 VarDecl [al_variable_decl]
88 replace [repeat ruby_lang_stmt]
93 function initDecl2 VarDecl [al_variable_decl]
96 replace [repeat ruby_lang_stmt]
101 function initDecl3 VarDecl [al_variable_decl]
104 replace [repeat ruby_lang_stmt]
109 function initDecl4 VarDecl [al_variable_decl]
112 replace [repeat ruby_lang_stmt]
117 function initDecl5 VarDecl [al_variable_decl]
119 'int Id [id] Union [union] ';
120 replace [repeat ruby_lang_stmt]
122 Id '= '[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] ';
126 function alStmtToRuby1 AlStmt [action_lang_stmt]
128 VarDecl [al_variable_decl]
130 Type [al_type_decl] Id [id] OptUnion [opt union] ';
131 replace [repeat ruby_lang_stmt]
133 _ [initDecl1 VarDecl] [initDecl2 VarDecl]
134 [initDecl3 VarDecl] [initDecl4 VarDecl]
138 function alExprExtendToRuby AlExprExtend [repeat al_expr_extend]
139 deconstruct AlExprExtend
140 Op [al_expr_op] Term [al_term] Rest [repeat al_expr_extend]
141 construct RubyRest [repeat ruby_expr_extend]
142 _ [alExprExtendToRuby Rest]
143 replace [repeat ruby_expr_extend]
148 % Note: this doesn't go into the ( al_expr ) form of al_term.
149 function alExprToRuby AlExpr [al_expr]
151 ALTerm [al_term] AlExprExtend [repeat al_expr_extend]
152 construct RubyExprExtend [repeat ruby_expr_extend]
153 _ [alExprExtendToRuby AlExprExtend]
154 construct Result [opt ruby_expr]
155 ALTerm RubyExprExtend
156 replace [opt ruby_expr]
161 function alStmtToRuby2 AlStmt [action_lang_stmt]
164 construct OptRubyExpr [opt ruby_expr]
165 _ [alExprToRuby AlExpr]
166 deconstruct OptRubyExpr
168 replace [repeat ruby_lang_stmt]
174 replace [repeat ruby_lang_stmt]
175 'do Block [repeat ruby_lang_stmt] 'end
180 function alOptElseRuby AlOptElse [opt al_else]
181 deconstruct AlOptElse
183 AlSubStmt [action_lang_stmt]
184 construct AlSubStmts [repeat action_lang_stmt]
186 construct RubySubStmts [repeat ruby_lang_stmt]
187 _ [alToRuby AlSubStmts]
188 deconstruct RubySubStmts
189 RubySubStmt [ruby_lang_stmt]
190 replace [opt ruby_else]
193 RubySubStmts [liftBlock]
196 function alStmtToRuby3 AlStmt [action_lang_stmt]
198 'if '( AlExpr [al_expr] ')
199 AlSubStmt [action_lang_stmt]
200 AlOptElse [opt al_else]
201 construct OptRubyExpr [opt ruby_expr]
202 _ [alExprToRuby AlExpr]
203 deconstruct OptRubyExpr
205 construct AlSubStmts [repeat action_lang_stmt]
207 construct RubySubStmts [repeat ruby_lang_stmt]
208 _ [alToRuby AlSubStmts]
209 construct OptRubyElse [opt ruby_else]
210 _ [alOptElseRuby AlOptElse]
211 replace [repeat ruby_lang_stmt]
214 RubySubStmts [liftBlock]
219 function alStmtToRuby4a AlStmt [action_lang_stmt]
222 replace [repeat ruby_lang_stmt]
227 function alStmtToRuby4b AlStmt [action_lang_stmt]
229 'prints String [stringlit] ';
230 replace [repeat ruby_lang_stmt]
232 'print '( String ') ';
235 function alStmtToRuby5 AlStmt [action_lang_stmt]
237 '{ AlSubStmts [repeat action_lang_stmt] '}
238 construct RubySubStmts [repeat ruby_lang_stmt]
239 _ [alToRuby AlSubStmts]
240 replace [repeat ruby_lang_stmt]
242 'do RubySubStmts 'end
245 function alStmtToRuby6 AlStmt [action_lang_stmt]
247 RagelStmt [al_ragel_stmt]
248 replace [repeat ruby_lang_stmt]
256 construct BaseId [id]
259 BaseId [unquote CharLit]
260 construct EmptyString [stringlit]
262 construct Repl [stringlit]
263 EmptyString [quote Id]
269 function alToRuby AlStmts [repeat action_lang_stmt]
271 FirstStmt [action_lang_stmt] Rest [repeat action_lang_stmt]
272 construct RubyFirst [repeat ruby_lang_stmt]
274 [alStmtToRuby1 FirstStmt]
275 [alStmtToRuby2 FirstStmt]
276 [alStmtToRuby3 FirstStmt]
277 [alStmtToRuby4a FirstStmt]
278 [alStmtToRuby4b FirstStmt]
279 [alStmtToRuby5 FirstStmt]
280 [alStmtToRuby6 FirstStmt]
282 construct RubyRest [repeat ruby_lang_stmt]
284 replace [repeat ruby_lang_stmt]
286 RubyFirst [. RubyRest]
290 replace [al_host_block]
291 '{ AlStmts [repeat action_lang_stmt] '}
292 construct RubyStmts [repeat ruby_lang_stmt]
298 rule lowercaseMachine
299 replace $ [machine_stmt]
302 'machine Id [tolower] ';
305 function langTransRuby
307 Definitions [repeat action_lang_stmt]
309 Initializations [repeat action_lang_stmt]
311 construct RubyDefinitions [repeat ruby_lang_stmt]
312 _ [alToRuby Definitions]
313 construct RubyInitializations [repeat ruby_lang_stmt]
314 _ [alToRuby Initializations]
315 construct NewRagelDef [ragel_def]
316 RagelDef [actionTransRuby] [lowercaseMachine]
317 import ArrayInits [ruby_statements]
318 ArrayInitStmts [repeat ruby_lang_stmt]
322 ArrayInitStmts [. RubyInitializations]
329 export ArrayInits [ruby_statements]