Exemple #1
0
int main(int argc, char** argv)
{
    // Should ParseCommandLineOptions be able to accept a const argv?
    llvm::cl::ParseCommandLineOptions(argc, argv, "ploy compiler\n");

    const char* file_location = InputFile.c_str();

    symbol_table* tbl = sym_tbl = init_symbol_table();
    init_symbols(tbl);

    pointer ret = parse_file_to_tree(file_location, tbl);
    if(!ret)
        return 1;

    materialize_includes(&ret, tbl);

    ploy_do_compile(ret, tbl);
    type_map type_define_map;
    transform_tree_gen_typedef(ret, tbl, &type_define_map);
    transform_tree_gen_typeinfo(ret, tbl, &type_define_map);

    compiler* compile = init_compiler(tbl);

    compiler_compile_expression(compile, ret, EntryFunc.c_str());
    compiler_print_module(compile);
    compiler_write_asm_file(compile, OutputFile.c_str());

    destroy_compiler(compile);

    destroy_symbol_table(tbl);
    return 0;
}
Exemple #2
0
static FrList *symtab_delete(istream &in,const FrList *symtabs)
{
   FrSymbol *sym = get_symbol(cout,in,"FrSymbol table's name:") ;
   FrSymbolTable *old_symtab = FrSymbolTable::selectDefault() ;
   FrCons *assoc = listassoc(symtabs,sym,equal) ;

   if (assoc)
      {
      old_symtab->select() ;
      destroy_symbol_table((FrSymbolTable *)assoc->cdr()) ;
      return listremove(symtabs,assoc,equal) ;
      }
   else
      {
      cout << "\nYou have not defined a symbol table by that name!" << endl ;
      old_symtab->select() ;
      return (FrList *)symtabs ;
      }
}