Commits

birkenfeld  committed 7926c66

Dump code and AST when executing a file.

  • Participants
  • Parent commits 8d8697f

Comments (0)

Files changed (3)

 _arana_ast_optimize_visit(AR_SIG, ArAstNode *node, void *ignored)
 {
     ArExprNode *enode = (ArExprNode *)node;
+    /* rewrite +Literal(int) or -Literal(int) into Literal([-]int) */
     if (AR_AST_IS(node, UnaryOp) && AR_AST_IS(enode->v.UnaryOp.expr, Literal) &&
         (enode->v.UnaryOp.op == AR_ASTOP_POS ||
          enode->v.UnaryOp.op == AR_ASTOP_NEG)) {

File arana/lexnparse.rl

                                            expr->v.ExprStmt.expr);
         }
     }
-    arana_ast_dump(AR_ISIG, (ArAstNode *)ret, stdout);
     return ret;
 }
 

File arana/main.c

     /* execute code -- XXX factor that out */
     arana_ast_set_filename(AR_ISIG, ast, fn);
     arana_ast_optimize(AR_ISIG, ast);
+    arana_ast_dump(AR_ISIG, ast, stdout);
     ArCode *codeobj = AR_COMPILE(ast);
+    AR_DEBUG_CODE(codeobj);
     ArFrame *frame = AR_FRAME(codeobj);
     AR_EVALUATE(frame);
     return 0;