Result
end function
+function alTermToD
+ replace [al_term]
+ 'first_token_char
+ by
+ 'ts '[0]
+end function
+
function alExprExtendToD AlExprExtend [repeat al_expr_extend]
deconstruct AlExprExtend
Op [al_expr_op] Term [al_term] Rest [repeat al_expr_extend]
_ [alExprExtendToD Rest]
replace [repeat d_expr_extend]
by
- Op Term DRest
+ Op Term [alTermToD] DRest
end function
function alExprToD AlExpr [al_expr]
construct DExprExtend [repeat d_expr_extend]
_ [alExprExtendToD AlExprExtend]
construct Result [opt d_expr]
- ALTerm DExprExtend
+ ALTerm [alTermToD] DExprExtend
replace [opt d_expr]
by
Result
'printi Id [id] ';
replace [repeat d_lang_stmt]
by
- 'writef '( '"%d" ', Id ');
+ 'writef '( '"%d" ', Id ') ';
end function
function alStmtToD4b AlStmt [action_lang_stmt]
'prints String [stringlit] ';
replace [repeat d_lang_stmt]
by
- 'writef '( '"%s" ', String ');
+ 'writef '( '"%s" ', String ') ';
+end function
+
+function alStmtToD4c AlStmt [action_lang_stmt]
+ deconstruct AlStmt
+ 'printb Id [id] ';
+ replace [repeat d_lang_stmt]
+ by
+ '_s '= Id '[0..pos] ';
+ 'writef '( '"%s" ', '_s ') ';
+end function
+
+function alStmtToD4d AlStmt [action_lang_stmt]
+ deconstruct AlStmt
+ 'print_token ';
+ replace [repeat d_lang_stmt]
+ by
+ '_s '= ts '[0..(te-ts)] ';
+ 'writef '( '"%s" ', '_s ') ';
end function
function alStmtToD5 AlStmt [action_lang_stmt]
[alStmtToD3 FirstStmt]
[alStmtToD4a FirstStmt]
[alStmtToD4b FirstStmt]
+ [alStmtToD4c FirstStmt]
+ [alStmtToD4d FirstStmt]
[alStmtToD5 FirstStmt]
[alStmtToD6 FirstStmt]
construct DRest [repeat d_lang_stmt]