Exemple #1
0
int main(void)
{
   ast_t * a;
   int jval;
   jit_t * jit;
   
   GC_INIT();
   GREG g;
 
   ast_init();
   sym_tab_init();
   types_init();
   scope_init();
   loc_tab_init();
   intrinsics_init();
   jit = llvm_init();
   ZZ_init(jit);
   
   yyinit(&g);

   printf("Welcome to Bacon v0.1\n\n");
   printf("> ");

   while (1)
   {
      if (!(jval = setjmp(exc)))
      {
         if (!yyparse(&g))
         {
            printf("Error parsing\n");
            abort();
         } else if (root)
         {
#if DEBUG1
            printf("\n");
            ast_print(root, 0);
#endif
            inference(root);
#if DEBUG2
            printf("\n");
            /*ast2_print(root, 0);*/
#endif
            exec_root(jit, root);
            root = NULL;
         }
      } else if (jval == 1)
         root = NULL;
      else /* jval == 2 */
         break;
      
      printf("\n> ");
   }

   llvm_cleanup(jit);
   yydeinit(&g);
    
   printf("\n");

   return 0;
}
Exemple #2
0
int main(void) {
    GC_INIT();
    GREG g;
 
    int jval, jval2;
    char c;

    sym_tab_init();
    ast_init();
    type_init();
    scope_init();
    rel_assign_init();

    jit_t * jit = llvm_init();

    yyinit(&g);

    printf("Welcome to Cesium v 0.2\n");
    printf("To exit press CTRL-D\n\n");

    printf("> ");

    while (1)
    {
       if (!(jval = setjmp(exc)))
       {
          if (!yyparse(&g))
          {
             printf("Error parsing\n");
             abort();
          } else if (root != NULL)
          {
             rel_stack_init();
             rel_assign_mark();
             scope_mark();
             annotate_ast(root);
             if (TRACE) 
                ast_print(root, 0);
             unify(rel_stack, rel_assign);
             if (TRACE)
                print_assigns(rel_assign);
             exec_root(jit, root);
             if (root->tag != AST_FNDEC)
                 rel_assign_rewind();
           }
        } else if (jval == 1)
              root = NULL;
        else if (jval == 2)
              break;
        printf("\n> ");
    }
  
    yydeinit(&g);
    llvm_cleanup(jit);

    return 0;
}
Exemple #3
0
  VM::~VM() {
    delete om;

    delete signal_events;

    delete global_cache;
#ifdef ENABLE_LLVM
    if(!reuse_llvm) llvm_cleanup();
#endif
  }