bool CompilerLocatorGCC::Locate()
{
    // Locate GCC under /usr/bin
    m_compilers.clear();

    wxArrayString gcc_versions;
    gcc_versions.Add(""); // Default gcc
    gcc_versions.Add("4.2");
    gcc_versions.Add("4.3");
    gcc_versions.Add("4.4");
    gcc_versions.Add("4.5");
    gcc_versions.Add("4.6");
    gcc_versions.Add("4.7");
    gcc_versions.Add("4.8");
    gcc_versions.Add("4.9");

    for(size_t i=0; i<gcc_versions.GetCount(); ++i) {
        wxString suffix = gcc_versions.Item(i);
        if ( !suffix.IsEmpty() ) {
            suffix.Prepend("-");
        }

        wxFileName gccFile("/usr/bin", "gcc" + suffix);
        if ( gccFile.FileExists() ) {
            // add this compiler
            CompilerPtr compiler( new Compiler(NULL) );
            wxString toolchainName;
            toolchainName << "GCC";
            if ( !gcc_versions.Item(i).IsEmpty() ) {
                toolchainName << " ( " << gcc_versions.Item(i) << " )";
            }
            compiler->SetName( toolchainName );
            compiler->SetGenerateDependeciesFile(true);
            compiler->SetCompilerFamily(COMPILER_FAMILY_GCC);
            m_compilers.push_back( compiler );
            AddTools(compiler, "/usr/bin", gcc_versions.Item(i));
        }
    }

    // XCode GCC is installed under /Applications/Xcode.app/Contents/Developer/usr/bin
    wxFileName xcodeGcc("/Applications/Xcode.app/Contents/Developer/usr/bin", "gcc");
    if ( xcodeGcc.FileExists() ) {
        // add this compiler
        CompilerPtr compiler( new Compiler(NULL) );
        compiler->SetCompilerFamily(COMPILER_FAMILY_GCC);
        compiler->SetName("GCC ( XCode )");
        m_compilers.push_back( compiler );
        AddTools(compiler, xcodeGcc.GetPath());
    }

    return !m_compilers.empty();
}
예제 #2
0
///////////////////////////////////////////////////////////////////////////////
// test_dynamic
void test_dynamic()
{
    typedef std::vector<UChar>::const_iterator uchar_iterator;
    typedef basic_regex<uchar_iterator> uregex;
    typedef match_results<uchar_iterator> umatch;
    typedef regex_compiler<uchar_iterator, UChar_traits> uregex_compiler;

    std::string pattern_("b.*r"), str_("foobarboo");
    std::vector<UChar> pattern(pattern_.begin(), pattern_.end());
    std::vector<UChar> str(str_.begin(), str_.end());

    UChar_traits tr;
    uregex_compiler compiler(tr);
    uregex urx = compiler.compile(pattern);
    umatch what;

    if(!regex_search(str, what, urx))
    {
        BOOST_ERROR("regex_search on UChar failed");
    }
    else
    {
        BOOST_CHECK_EQUAL(3, what.position());
        BOOST_CHECK_EQUAL(3, what.length());
    }

    // test for range-based regex_replace
    std::vector<UChar> output = regex_replace(str, urx, pattern_);
    std::string output_(output.begin(), output.end());
    std::string expected("foob.*rboo");
    BOOST_CHECK_EQUAL(output_, expected);
}
예제 #3
0
파일: test.c 프로젝트: matsimon/RA
/* Compiler */
void test_compiler(char *expr, long eval) {
    initialize();
    compiler(expr,TESTFILE);
    loadFile(TESTFILE);
    run();
    assert(loadWord(SP) == eval);
}
예제 #4
0
파일: nmethod.cpp 프로젝트: AaronNGray/self
fint nmethod::nsends(bool includeAll) {
  // add up the inlinable sends of the nmethod (i.e. those sent by inline
  // caches with comparing stubs); if includeAll, also count non-inlinable
  // sends
  fint nsends = 0;
  bool isNIC = compiler() == NIC;
  for (addrDesc* a = locs(), *aend = locsEnd(); a < aend; a++) {
    if (a->isSendDesc()) {
      sendDesc* sd = a->asSendDesc(this);
      if (!sd->isUninlinable()) {
        nsends += sd->nsends();
      } else if (isNIC && sd->countType() == Counting) {
        // must be a method containing _Restart
        nsends += sd->nsends();
      } else if (isNIC) {
        // NIC methods have no count stubs (to save space) but count the
        // # of invocations; assume all sends in NIC method are executed
        // once per execution of the method
        nsends += useCount[id];
      } else if (includeAll) {
        nsends += sd->nsends();
      }
    }
  }
  return nsends;
}
예제 #5
0
    // Builds an overlay subgraph to project down onto the scene. This is the highlighting
    // geometry for the selected feature.
    void highlight( osgGIS::FeatureCursor& cursor )
    {
        osgGIS::FilterGraph* graph = new osgGIS::FilterGraph();

        osgGIS::ChangeShapeTypeFilter* change = new osgGIS::ChangeShapeTypeFilter();
        change->setNewShapeType( osgGIS::GeoShape::TYPE_POLYGON );
        graph->appendFilter( change );

        osgGIS::BufferFilter* buffer = new osgGIS::BufferFilter( 1.25 ); //meters
        graph->appendFilter( buffer );
        
        osgGIS::TransformFilter* xform = new osgGIS::TransformFilter();
        xform->setSRS( terrain_srs.get() );
        xform->setLocalize( true );
        graph->appendFilter( xform );

        osgGIS::BuildGeomFilter* geom = new osgGIS::BuildGeomFilter();
        geom->setColorScript( new osgGIS::Script( "vec4(1,1,0,.4)" ) );
        graph->appendFilter( geom );

        graph->appendFilter( new osgGIS::CollectionFilter() );

        osgGIS::BuildNodesFilter* nodes = new osgGIS::BuildNodesFilter();
        nodes->setDisableLighting( true );
        graph->appendFilter( nodes );

        osgGIS::SimpleLayerCompiler compiler( graph );
        osg::Node* result = compiler.compile( layer.get(), cursor );

        overlay->setOverlaySubgraph( result );
        overlay->dirtyOverlayTexture();
    }
BOOST_AUTO_TEST_CASE_TEMPLATE( stableInsert, SorterT, sorter_types )
{
  // simulating  permutation
  std::vector<std::pair<std::string, std::string>> test_data = {
    { "aa", "\"{1:2}\"" },
    { "ab", "\"{2:44}\""},
    { "bb", "\"{33:23}\"" },
    { "cc", "\"{3:24}\"" },
    { "aa", "\"{2:27}\"" },
    { "zz", "\"{3:21}\"" },
    { "zz", "\"{5:22}\"" },
    { "aa", "\"{3:24}\"" },
  };

  keyvi::dictionary::compiler_param_t params = {{STABLE_INSERTS, "true"}};

  keyvi::dictionary::DictionaryCompiler<
      fsa::internal::SparseArrayPersistence<uint16_t>,
      fsa::internal::JsonValueStore,
      SorterT> compiler(10485760, params);

  for (auto p: test_data){
    compiler.Add(p.first, p.second);
  }

  // test delete
  compiler.Delete("ab");

  compiler.Compile();

  boost::filesystem::path temp_path =
      boost::filesystem::temp_directory_path();

  temp_path /= boost::filesystem::unique_path(
      "dictionary-unit-test-dictionarycompiler-%%%%-%%%%-%%%%-%%%%");
  std::string file_name = temp_path.native();

  compiler.WriteToFile(file_name);

  Dictionary d(file_name.c_str());

  fsa::automata_t f(d.GetFsa());

  fsa::EntryIterator it(f);
  fsa::EntryIterator end_it;

  BOOST_CHECK_EQUAL("aa", it.GetKey());
  BOOST_CHECK_EQUAL("\"{3:24}\"", it.GetValueAsString());
  ++it;
  BOOST_CHECK_EQUAL("bb", it.GetKey());
  BOOST_CHECK_EQUAL("\"{33:23}\"", it.GetValueAsString());
  ++it;
  BOOST_CHECK_EQUAL("cc", it.GetKey());
  BOOST_CHECK_EQUAL("\"{3:24}\"", it.GetValueAsString());
  ++it;
  BOOST_CHECK_EQUAL("zz", it.GetKey());
  BOOST_CHECK_EQUAL("\"{5:22}\"", it.GetValueAsString());
  ++it;
  BOOST_CHECK(it == end_it);
}
예제 #7
0
void Program::Compile( const char *filename )
{
    char *src;
    Compiler compiler( *this );
    int filenum;

    str oldfile( s_file );

    s_file = filename;
    if ( gi.FS_ReadFile( filename, ( void ** )&src, true ) < 0 )
    {
        s_file = oldfile;
        gi.WPrintf( "***\n***\n***\n*** Couldn't load %s\n***\n***\n***\n", filename );
        throw "Error";
    }

    filenum = filenames.AddObject( s_file );
    //if ( !compiler.CompileFile( src, filename, filenum ) )
    if ( !compiler.CompileFile( src, filenum ) )
    {
        s_file = oldfile;
        gi.FS_FreeFile( src );
        gi.WPrintf( "Compile failed.\n" );
        throw "Error";
    }

    gi.FS_FreeFile( src );
    s_file = oldfile;
}
CompilerPtr CompilerLocatorCrossGCC::Locate(const wxString& folder, bool clear)
{
    if(clear) {
        m_compilers.clear();
    }

    wxArrayString matches;
    wxFileName fnFolder(folder, "");

    // We collect "*-gcc" files
    wxString pattern = "*-gcc";
#ifdef __WXMSW__
    pattern << ".exe";
#endif

    int count = wxDir::GetAllFiles(fnFolder.GetPath(), &matches, pattern, wxDIR_FILES);
    if(count == 0) {
        // try to see if we have a 'bin' folder under 'folder'
        fnFolder.AppendDir("bin");
        if(wxDir::Exists(fnFolder.GetPath())) {
            count = wxDir::GetAllFiles(fnFolder.GetPath(), &matches, pattern, wxDIR_FILES);
        }
    }

    if(count == 0) return NULL;

    for(int i = 0; i < count; ++i) {
#ifndef __WXMSW__
        // Check if this is a script
        char sha[2];
        wxFile(matches[i]).Read(sha, 2);
        if(strncmp(sha, "#!", 2) == 0) {
            continue;
        }
#endif
        wxFileName filename(matches.Item(i));
        if(filename.GetName() == "mingw32-gcc" || filename.GetName() == "x86_64-w64-mingw32-gcc") {
            // Don't include standard mingw32-gcc (32 and 64 bit) binaries
            // they will be picked up later by the MinGW locator
            continue;
        }

        CompilerPtr compiler(new Compiler(NULL));
        compiler->SetCompilerFamily(COMPILER_FAMILY_GCC);

        // get the compiler version
        compiler->SetName(filename.GetName());
        compiler->SetGenerateDependeciesFile(true);
        m_compilers.push_back(compiler);

        // we path the bin folder
        AddTools(compiler, filename.GetPath(), filename.GetName().BeforeLast('-'), filename.GetExt());
    }

    if(m_compilers.empty()) {
        return NULL;
    } else {
        return *m_compilers.begin();
    }
}
예제 #9
0
파일: tilek.cpp 프로젝트: 8l/rose
int main(int argc, char ** argv) {
  std::vector<std::string> args(argv, argv + argc);

#if defined(TILEK_ACCELERATOR)
#  if defined(TILEK_TARGET_OPENCL)
  args.push_back("-DSKIP_OPENCL_SPECIFIC_DEFINITION");
#  endif
#endif

  SgProject * project = new SgProject(args);
  assert(project->numberOfFiles() == 1);

  SgSourceFile * source_file = isSgSourceFile(project->get_fileList()[0]);
  assert(source_file != NULL);

  std::string filename = source_file->get_sourceFileNameWithoutPath();
  std::string basename = filename.substr(0, filename.find_last_of('.'));

  KLT::DLX::Compiler< ::DLX::TileK::language_t, ::KLT::TileK::Generator> compiler(project, KLT_PATH, TILEK_PATH, basename);

//  MFB::api_t * api = compiler.getDriver().getAPI();
//  dump_api(api);

  compiler.compile(project);

  project->unparse();

  return 0;
}
예제 #10
0
void compile_integer(std::vector<std::string>& input, std::string& output, size_t memory_limit,
             size_t partition_size = 0) {
  keyvi::dictionary::DictionaryCompiler<
      keyvi::dictionary::fsa::internal::SparseArrayPersistence<BucketT>,
      keyvi::dictionary::fsa::internal::IntValueStoreWithInnerWeights> compiler(
      memory_limit);

  std::function<std::pair<std::string, uint32_t>(std::string)> parser = [] (std::string line) {
    size_t tab = line.find('\t');

    if (tab == std::string::npos)
      return std::pair<std::string, uint32_t>();

    std::string key = line.substr(0, tab);
    std::string value_as_string = line.substr(tab + 1);
    uint32_t value;

    try {
      value = boost::lexical_cast<uint32_t>(value_as_string);
    } catch (boost::bad_lexical_cast const&) {
      std::cout << "Error: value was not valid: " << line << std::endl;
      return std::pair<std::string, uint32_t>();
    }
      return std::pair<std::string, uint32_t>(key, value);
  };
  compile_multiple(compiler, parser, input);

  finalize_compile(compiler, output, partition_size);
}
예제 #11
0
// Common code for sandbox startup.
static void
SetCurrentProcessSandbox(UniquePtr<sandbox::bpf_dsl::Policy> aPolicy)
{
  MOZ_ASSERT(gSandboxCrashFunc);

  // Note: PolicyCompiler borrows the policy and registry for its
  // lifetime, but does not take ownership of them.
  sandbox::bpf_dsl::PolicyCompiler compiler(aPolicy.get(),
                                            sandbox::Trap::Registry());
  auto program = compiler.Compile();
  if (SandboxInfo::Get().Test(SandboxInfo::kVerbose)) {
    sandbox::bpf_dsl::DumpBPF::PrintProgram(*program);
  }

  InstallSigSysHandler();

#ifdef MOZ_ASAN
  __sanitizer_sandbox_arguments asanArgs;
  asanArgs.coverage_sandboxed = 1;
  asanArgs.coverage_fd = -1;
  asanArgs.coverage_max_block_size = 0;
  __sanitizer_sandbox_on_notify(&asanArgs);
#endif

  // The syscall takes a C-style array, so copy the vector into one.
  UniquePtr<sock_filter[]> flatProgram(new sock_filter[program->size()]);
  for (auto i = program->begin(); i != program->end(); ++i) {
    flatProgram[i - program->begin()] = *i;
  }

  BroadcastSetThreadSandbox(Move(flatProgram), program->size());
}
예제 #12
0
//! (static)
ObjRef _eval(Runtime & runtime, const CodeFragment & code){
	Compiler compiler(runtime.getLogger());
	ERef<UserFunction> script = compiler.compile(code);
	if(script.isNull())
		return nullptr;
	return runtime.executeFunction(script.get(),nullptr,ParameterValues());
}
예제 #13
0
ShaderModuleBase::ShaderModuleBase(DevicePtr dptr, const SpirVData& data) : DeviceLinked(dptr), _module(create_shader_module(dptr, data)) {
	spirv_cross::Compiler compiler(std::vector<u32>(data.data(), data.data() + data.size() / 4));

	_type = module_type(compiler);

	auto resources = compiler.get_shader_resources();
	merge(_bindings, create_bindings(compiler, resources.uniform_buffers, _type, vk::DescriptorType::eUniformBuffer));
	merge(_bindings, create_bindings(compiler, resources.storage_buffers, _type, vk::DescriptorType::eStorageBuffer));
	merge(_bindings, create_bindings(compiler, resources.sampled_images, _type, vk::DescriptorType::eCombinedImageSampler));
	merge(_bindings, create_bindings(compiler, resources.storage_images, _type, vk::DescriptorType::eStorageImage));

	_push_constants = create_push_constants(compiler, resources.push_constant_buffers, _type);

	_attribs = create_attribs(compiler, resources.stage_inputs);

	// these are attribs & other stages stuff
	fail_not_empty(resources.atomic_counters);
	fail_not_empty(resources.separate_images);
	fail_not_empty(resources.separate_samplers);

	u32 spec_offset = 0;
	for(const auto& cst : compiler.get_specialization_constants()) {
		const auto& type = compiler.get_type(compiler.get_constant(cst.id).constant_type);
		u32 size = type.width / 8;
		_spec_constants << vk::SpecializationMapEntry(cst.constant_id, spec_offset, size);
		spec_offset += size;
	}

	for(usize i = 0; i != 3; ++i) {
		_local_size[i] = compiler.get_execution_mode_argument(spv::ExecutionMode::ExecutionModeLocalSize, i);
	}
}
예제 #14
0
inline void z::CmakeGenerator::Impl::generateConfig(const z::Ast::Config& config) {
    z::Compiler compiler(_project, config);
    compiler.compile();
    z::dir::mkpath(config.srcdir() + "/");
    z::ofile osPro(config.srcdir() + "/" + "CMakeLists.txt");
    generateProject(config, osPro);
}
예제 #15
0
void parse(std::vector<Instruction> &insns, FILE *input) {
    Compiler compiler(&insns);
    int ch = 0;
    while ((ch=getc(input)) != EOF) {
        switch (ch) {
        case '+':
            compiler.push_simple(INC);
            break;
        case '-':
            compiler.push_simple(DEC);
            break;
        case '>':
            compiler.push_simple(NEXT);
            break;
        case '<':
            compiler.push_simple(PREV);
            break;
        case ',':
            compiler.push_simple(GET);
            break;
        case '.':
            compiler.push_simple(PUT);
            break;
        case '[':
            compiler.push_open();
            break;
        case ']':
            compiler.push_close();
            break;
        }
    }
    compiler.push_simple(END);
}
void Doom3MapCompiler::generateProc(const scene::INodePtr& root)
{
	rMessage() << "=== DMAP: GenerateProc ===" << std::endl;

	ProcCompiler compiler(root);

	_procFile = compiler.generateProcFile();
}
예제 #17
0
Ref<CompiledContentExtension> compileRuleList(const String& ruleList)
{
    auto parsedRuleList = parseRuleList(ruleList);

#if CONTENT_EXTENSIONS_PERFORMANCE_REPORTING
    double nfaBuildTimeStart = monotonicallyIncreasingTime();
#endif

    Vector<SerializedActionByte> actions;
    Vector<unsigned> actionLocations = serializeActions(parsedRuleList, actions);

    NFA nfa;
    URLFilterParser urlFilterParser(nfa);
    for (unsigned ruleIndex = 0; ruleIndex < parsedRuleList.size(); ++ruleIndex) {
        const ContentExtensionRule& contentExtensionRule = parsedRuleList[ruleIndex];
        const Trigger& trigger = contentExtensionRule.trigger();
        ASSERT(trigger.urlFilter.length());

        String error = urlFilterParser.addPattern(trigger.urlFilter, trigger.urlFilterIsCaseSensitive, actionLocations[ruleIndex]);

        if (!error.isNull()) {
            dataLogF("Error while parsing %s: %s\n", trigger.urlFilter.utf8().data(), error.utf8().data());
            continue;
        }
    }

#if CONTENT_EXTENSIONS_PERFORMANCE_REPORTING
    double nfaBuildTimeEnd = monotonicallyIncreasingTime();
    dataLogF("    Time spent building the NFA: %f\n", (nfaBuildTimeEnd - nfaBuildTimeStart));
#endif

#if CONTENT_EXTENSIONS_STATE_MACHINE_DEBUGGING
    nfa.debugPrintDot();
#endif

#if CONTENT_EXTENSIONS_PERFORMANCE_REPORTING
    double dfaBuildTimeStart = monotonicallyIncreasingTime();
#endif

    const DFA dfa = NFAToDFA::convert(nfa);

#if CONTENT_EXTENSIONS_PERFORMANCE_REPORTING
    double dfaBuildTimeEnd = monotonicallyIncreasingTime();
    dataLogF("    Time spent building the DFA: %f\n", (dfaBuildTimeEnd - dfaBuildTimeStart));
#endif

    // FIXME: never add a DFA that only matches the empty set.

#if CONTENT_EXTENSIONS_STATE_MACHINE_DEBUGGING
    dfa.debugPrintDot();
#endif

    Vector<DFABytecode> bytecode;
    DFABytecodeCompiler compiler(dfa, bytecode);
    compiler.compile();

    return CompiledContentExtension::create(WTF::move(bytecode), WTF::move(actions));
}
예제 #18
0
파일: gss.cpp 프로젝트: daid/GruesomeSpace
void GssEngine::compile(string code)
{
    instruction_pointer = 0;
    locals_stack_position = 0;
    
    try
    {
        GssTokenizer tokenizer(code);
        GssCompiler compiler(tokenizer);
        compiler.setNativeFunctions(native_functions);
        compiler.compile();
        LOG(INFO) << "----------------";
        int idx = 0;
        for(const GssInstruction& i : compiler.instructions)
        {
            LOG(INFO) << idx << ": " << i.toString();
            idx++;
        }
        LOG(INFO) << "----------------";
        instructions = compiler.instructions;
        string_table = compiler.string_table;
    }catch(GssTokenizerException e)
    {
        LOG(ERROR) << e.message;
        return;
    }catch(GssCompilerException e)
    {
        LOG(ERROR) << e.message;
        return;
    }
    
    memory = new GssMemory(1024*1024);
    
    for(unsigned int index=0; index<native_functions.size(); index++)
    {
        GssVariant* v = memory->getGlobal(index);
        v->type = GssVariant::Type::native_function;
        v->data.i = index;
    }
    
    try
    {
        while(instruction_pointer < instructions.size())
        {
            step();
        }
        LOG(INFO) << "Finished";
    }catch(GssRuntimeException e)
    {
        LOG(ERROR) << e.message;
    }catch(GssMemoryException e)
    {
        LOG(ERROR) << e.message;
    }
    LOG(INFO) << "Free memory: " << memory->getFreeMemoryAmount();
}
예제 #19
0
void tst_QDjangoCompiler::fieldNames()
{
    QDjangoCompiler compiler("Owner", QDjango::database());
    QCOMPARE(compiler.fieldNames(false), QStringList()
        << "\"owner\".\"id\""
        << "\"owner\".\"name\""
        << "\"owner\".\"item1_id\""
        << "\"owner\".\"item2_id\"");
    QCOMPARE(compiler.fromSql(), QLatin1String("\"owner\""));
}
예제 #20
0
파일: Compiler.cpp 프로젝트: DawidvC/magpie
  void Compiler::compileExpression(VM& vm, ErrorReporter& reporter,
                                   gc<Expr> expr, Module* module)
  {
    Compiler compiler(vm, reporter);

    compiler.declareTopLevel(expr, module);

    gc<Chunk> code = ExprCompiler(compiler).compileBody(module, expr);
    module->setBody(code);
  }
예제 #21
0
void CompilerLocatorCygwin::AddTools(const wxString& binFolder, const wxString& name, const wxString& suffix)
{
    wxFileName masterPath(binFolder, "");
    masterPath.RemoveLastDir();
    
    // Create an empty compiler
    CompilerPtr compiler( new Compiler(NULL) );
    compiler->SetCompilerFamily(COMPILER_FAMILY_CYGWIN);
    compiler->SetGenerateDependeciesFile(true);
    compiler->SetName( name );
    compiler->SetInstallationPath( masterPath.GetPath() );
    m_compilers.push_back( compiler );
    
    CL_DEBUG("Found Cygwin compiler under: %s. \"%s\"", masterPath.GetPath(), compiler->GetName());
    wxFileName toolFile(binFolder, "");

    toolFile.SetFullName( "g++-" + suffix + ".exe" );
    AddTool(compiler, "CXX", toolFile.GetFullPath());
    AddTool(compiler, "LinkerName", toolFile.GetFullPath());
    AddTool(compiler, "SharedObjectLinkerName", toolFile.GetFullPath(), "-shared -fPIC");

    toolFile.SetFullName( "gcc-" + suffix + ".exe" );
    AddTool(compiler, "CC", toolFile.GetFullPath());

    toolFile.SetFullName("ar.exe");
    AddTool(compiler, "AR", toolFile.GetFullPath(), "rcu");

    toolFile.SetFullName("windres.exe");
    AddTool(compiler, "ResourceCompiler", toolFile.GetFullPath());

    toolFile.SetFullName("as.exe");
    AddTool(compiler, "AS", toolFile.GetFullPath());
    
    toolFile.SetFullName("make.exe");
    wxString makeExtraArgs;
    if ( wxThread::GetCPUCount() > 1 ) {
        makeExtraArgs << "-j" << wxThread::GetCPUCount();
    }

    if ( toolFile.FileExists() ) {
        AddTool(compiler, "MAKE", toolFile.GetFullPath(), makeExtraArgs);
        
    } else {
        toolFile.SetFullName("mingw32-make.exe");
        if ( toolFile.FileExists() ) {
            AddTool(compiler, "MAKE", toolFile.GetFullPath(), makeExtraArgs);
        }
    }
    AddTool(compiler, "MakeDirCommand", "mkdir", "-p");
    
    toolFile.SetFullName("gdb.exe");
    if ( toolFile.FileExists() ) {
        AddTool(compiler, "Debugger", toolFile.GetFullPath());
    }
}
예제 #22
0
int main( int, char*[] )
{
    std::string code = "(test 42 ( - 44 ( + 1 1 ) ) )  ";
    Compiler compiler(code);

    Expression* program = compiler.compile();
    
    printValue( program->evaluate() );

    std::cout << std::endl << " ---DONE--- " << std::endl;
}
예제 #23
0
  void ExprCompiler::visit(FnExpr& expr, int dest)
  {
    // TODO(bob): Handle closures.
    ExprCompiler compiler(compiler_);
    gc<Chunk> chunk = compiler.compile(module_, expr);
    int index = chunk_->addChunk(chunk);

    write(expr, OP_FUNCTION, index, dest);

    compileClosures(expr.pos(), expr.resolved());
  }
예제 #24
0
// Allocates memory
fixnum factor_vm::quot_code_offset_to_scan(cell quot_, cell offset) {
  data_root<quotation> quot(quot_, this);
  data_root<array> array(quot->array, this);

  quotation_jit compiler(quot.value(), false, false, this);
  compiler.init_quotation(quot.value());
  compiler.compute_position(offset);
  compiler.iterate_quotation();

  return compiler.get_position();
}
예제 #25
0
 ScriptBuffer compileProgram(AvmCore* core, Toplevel* toplevel, String* code, String* filename)
 {
     AvmplusHostContext context(core, toplevel);
     StUTF16String src(code);
     StUTF16String fn(filename);
     AvmAssert(src.c_str()[src.length()-1] == 0);
     RTC::Compiler compiler(&context, filename == NULL ? NULL : fn.c_str(), src.c_str(), src.length(), true);
     TRY(core, kCatchAction_Rethrow) {
         compiler.compile();
         return context.script_buffer;
     }
예제 #26
0
bool SirenAssembly::Parse(const FileIdRef& file)
{
	if (mLoadedFiles.Contains(file.Name))
	{
		return true;
	}
	Log::FormatInfo("Parse:{}", file.Name);
	SirenTextParser compiler(*this);
	bool isSuccess = compiler.ParseFile(file);
	mLoadedFiles.Add(file.Name);
	return isSuccess;
}
예제 #27
0
  void ExprCompiler::visit(AsyncExpr& expr, int dest)
  {
    // TODO(bob): Handle closures.
    ExprCompiler compiler(compiler_);
    gc<Chunk> chunk = compiler.compile(module_, expr);
    int index = chunk_->addChunk(chunk);

    write(expr.pos(), OP_ASYNC, index);
    // TODO(bob): What about dest?

    compileClosures(expr.pos(), expr.resolved());
  }
BOOST_AUTO_TEST_CASE_TEMPLATE( addAndDeletes, SorterT, sorter_types )
{
  keyvi::dictionary::compiler_param_t params = {{STABLE_INSERTS, "true"}};

  keyvi::dictionary::DictionaryCompiler<
          fsa::internal::SparseArrayPersistence<uint16_t>,
          fsa::internal::JsonValueStore,
          SorterT> compiler(10485760, params);

  // add, delete, add again
  compiler.Add("aa", "1");
  compiler.Delete("aa");
  compiler.Delete("aa");
  compiler.Add("aa", "2");

  // delete, add
  compiler.Delete("bb");
  compiler.Add("bb", "1");

  // add, delete, last item
  compiler.Add("zz", "1");
  compiler.Delete("zz");

  compiler.Compile();

  boost::filesystem::path temp_path =
      boost::filesystem::temp_directory_path();

  temp_path /= boost::filesystem::unique_path(
        "dictionary-unit-test-dictionarycompiler-%%%%-%%%%-%%%%-%%%%");
  std::string file_name = temp_path.native();

  compiler.WriteToFile(file_name);

  Dictionary d(file_name.c_str());

  fsa::automata_t f(d.GetFsa());

  fsa::EntryIterator it(f);
  fsa::EntryIterator end_it;

  BOOST_CHECK_EQUAL("aa", it.GetKey());
  BOOST_CHECK_EQUAL("2", it.GetValueAsString());
  ++it;

  BOOST_CHECK_EQUAL("bb", it.GetKey());
  BOOST_CHECK_EQUAL("1", it.GetValueAsString());
  ++it;

  BOOST_CHECK(it == end_it);

  std::remove(file_name.c_str());
}
예제 #29
0
void CompilerLocatorCLANG::MSWLocate()
{
#ifdef __WXMSW__
    bool found = false;
    {
        wxRegKey reg(wxRegKey::HKCU, "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\LLVM");
        wxString llvmInstallPath;
        wxString llvmVersion;
        if ( reg.Exists() ) {
            found = true;
            reg.QueryValue("DisplayIcon",    llvmInstallPath);
            reg.QueryValue("DisplayVersion", llvmVersion);

            CompilerPtr compiler( new Compiler(NULL) );
            compiler->SetCompilerFamily(COMPILER_FAMILY_CLANG);
            compiler->SetGenerateDependeciesFile(true);
            compiler->SetName( wxString() << "clang ( " << llvmVersion << " )");
            m_compilers.push_back( compiler );
            AddTools(compiler, llvmInstallPath);
        }
    }
    if ( !found ) {
        wxRegKey reg(wxRegKey::HKLM, "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\LLVM");
        wxString llvmInstallPath;
        wxString llvmVersion;
        if ( reg.Exists() ) {
            reg.QueryValue("DisplayIcon",    llvmInstallPath);
            reg.QueryValue("DisplayVersion", llvmVersion);

            CompilerPtr compiler( new Compiler(NULL) );
            compiler->SetCompilerFamily(COMPILER_FAMILY_CLANG);
            compiler->SetGenerateDependeciesFile(true);
            compiler->SetName( wxString() << "clang ( " << llvmVersion << " )");
            m_compilers.push_back( compiler );
            AddTools(compiler, llvmInstallPath);
        }
    }
#endif

}
예제 #30
0
파일: Compiler.cpp 프로젝트: DawidvC/magpie
  void Compiler::compileModule(VM& vm, ErrorReporter& reporter,
                                  gc<ModuleAst> ast, Module* module)
  {
    Compiler compiler(vm, reporter);

    for (int i = 0; i < ast->body()->expressions().count(); i++)
    {
      compiler.declareTopLevel(ast->body()->expressions()[i], module);
    }

    gc<Chunk> code = ExprCompiler(compiler).compileBody(module, ast->body());
    module->setBody(code);
  }