Package org.openquark.cal.compiler

Examples of org.openquark.cal.compiler.SourceModelModuleSource


        help_testUnknownImport(gCALServices);
    }
   
    private void help_testUnknownImport(BasicCALServices calServices) {
        MessageLogger logger = new MessageLogger();
        SourceModelModuleSource moduleDefn = new SourceModelModuleSource(SourceModelUtilities.TextParsing.parseModuleDefnIntoSourceModel("module Foo; import Prelude; import UNKNOWN_Module;", logger));
       
        assertEquals(logger.getNErrors(), 0);
       
        calServices.addNewModule(moduleDefn, logger);
       
View Full Code Here


            final int threadID = i;
            threads[i] = new Thread() {
                public void run() {
                    ModuleName moduleName = ModuleName.make("TempModule" + threadID);
                    MessageLogger messageLogger = new MessageLogger();
                    workspaceManager.makeModule(new SourceModelModuleSource(SourceModelUtilities.TextParsing.parseModuleDefnIntoSourceModel("module " + moduleName + "; import " + CAL_Prelude.MODULE_NAME + "; public foo x = (\\y -> x + x + y) 3.0; public bar = foo;")), messageLogger);
                   
                    if (messageLogger.getNErrors() > 0) {
                        multithreadedAssertEquals("No compilation errors", messageLogger.toString(), assertList);
                    } else {
                        for (int k = 0; k < numDependentModules; k++) {
                            String moduleName2 = "TempModule" + threadID + "_" + k;
                            workspaceManager.makeModule(new SourceModelModuleSource(SourceModelUtilities.TextParsing.parseModuleDefnIntoSourceModel("module " + moduleName2 + "; import " + CAL_Prelude.MODULE_NAME + "; import " + moduleName + ";")), messageLogger);
                        }
                        if (messageLogger.getNErrors() > 0) {
                            multithreadedAssertEquals("No compilation errors", messageLogger.toString(), assertList);
                        } else {
                            for (int j = 0; j < numCompilationsPerThread; j++) {
View Full Code Here

                public void run() {
                    String moduleName = "TempMultithreadedModule" + threadID;
                    for (int j = 0; j < numCompilationsPerThread; j++) {
                        MessageLogger messageLogger = new MessageLogger();
                        try {
                            workspaceManager.makeModule(new SourceModelModuleSource(SourceModelUtilities.TextParsing.parseModuleDefnIntoSourceModel("module " + moduleName + "; import Prelude; public foo x = (\\y -> x + x + y) 3.0; public bar = foo;")), messageLogger);
                        } catch (Exception e) {
                            StringWriter sw = new StringWriter();
                            PrintWriter pw = new PrintWriter(sw);
                            e.printStackTrace(pw);
                            exceptionList.add(sw.toString());
View Full Code Here

     */
    public void testMakeModule() {
        ModuleName moduleName = ModuleName.make("TEST_MakeModule");
       
        SourceModel.ModuleDefn moduleDefn = SourceModel.ModuleDefn.make(moduleName, new SourceModel.Import[] { SourceModel.Import.make(CAL_Prelude.MODULE_NAME) }, null);
        ModuleSourceDefinition moduleSourceDefn = new SourceModelModuleSource(moduleDefn);

        try {
            CompilerMessageLogger logger = new MessageLogger();
            Severity severity = workspaceManager.makeModule(moduleSourceDefn, logger);
           
View Full Code Here

     */
    public void testMakeModules() {
        ModuleName[] moduleNames = { ModuleName.make("TEST_MakeModules1"), ModuleName.make("TEST_MakeModules2") };
       
        SourceModel.ModuleDefn moduleDefn1 = SourceModel.ModuleDefn.make(moduleNames[0], new SourceModel.Import[] { SourceModel.Import.make(CAL_Prelude.MODULE_NAME) }, null);
        ModuleSourceDefinition moduleSourceDefn1 = new SourceModelModuleSource(moduleDefn1);

        SourceModel.ModuleDefn moduleDefn2 = SourceModel.ModuleDefn.make(moduleNames[1], new SourceModel.Import[] { SourceModel.Import.make(CAL_Prelude.MODULE_NAME) }, null);
        ModuleSourceDefinition moduleSourceDefn2 = new SourceModelModuleSource(moduleDefn2);
       
        ModuleSourceDefinition[] moduleSourceDefns = { moduleSourceDefn1, moduleSourceDefn2 };
       
        ModuleSourceDefinitionGroup mdg = new ModuleSourceDefinitionGroup(moduleSourceDefns);

View Full Code Here

     */
    public void testRemoveModule() {
        ModuleName[] moduleNames = { ModuleName.make("TEST_RemoveModules1"), ModuleName.make("TEST_RemoveModules2") };
       
        SourceModel.ModuleDefn moduleDefn1 = SourceModel.ModuleDefn.make(moduleNames[0], new SourceModel.Import[] { SourceModel.Import.make(CAL_Prelude.MODULE_NAME) }, null);
        ModuleSourceDefinition moduleSourceDefn1 = new SourceModelModuleSource(moduleDefn1);

        SourceModel.ModuleDefn moduleDefn2 = SourceModel.ModuleDefn.make(moduleNames[1], new SourceModel.Import[] { SourceModel.Import.make(CAL_Prelude.MODULE_NAME), SourceModel.Import.make(moduleNames[0]) }, null);
        ModuleSourceDefinition moduleSourceDefn2 = new SourceModelModuleSource(moduleDefn2);
       
        ModuleSourceDefinition[] moduleSourceDefns = { moduleSourceDefn1, moduleSourceDefn2 };
       
        ModuleSourceDefinitionGroup mdg = new ModuleSourceDefinitionGroup(moduleSourceDefns);

View Full Code Here

        }
       
        CompilerMessageLogger logger = new MessageLogger();
       
        //add the module to the workspace
        CompilerMessage.Severity errorLevel = addNewModule(new SourceModelModuleSource(newModule), logger);
       
        if (errorLevel.compareTo(CompilerMessage.Severity.ERROR) >= 0) {
            throw new GemCompilationException("Error adding new module", logger);
        }
               
View Full Code Here

       
        // First, we add the source-model based module definition as a new module to the workspace
        MessageLogger logger = new MessageLogger();
       
        //Create functions for factorial, outlier detection and map and add them to the program
        services.addNewModule(new SourceModelModuleSource(makeGemDemoModule()), logger);
           
        //run the factorial function
        runFactorialDemo(services);
       
        //run the positive outlier detector
View Full Code Here

TOP

Related Classes of org.openquark.cal.compiler.SourceModelModuleSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.