Package org.openquark.cal.compiler

Examples of org.openquark.cal.compiler.MessageLogger


    }
   
    private void help_testProgramEvaluatorEval_OutputNonPrimitiveArray(BasicCALServices calServices) throws CALExecutorException {
        String functionName = "tempFunc";
               
        CompilerMessageLogger logger = new MessageLogger();
        EntryPoint entryPoint = calServices.getCompiler().getEntryPoint(
            new AdjunctSource.FromSourceModel(
                SourceModel.FunctionDefn.Algebraic.make(
                    functionName, Scope.PRIVATE, null,
                    SourceModel.Expr.makeGemCall(CAL_Array.Functions.subscript,
View Full Code Here


        help_testUnknownImport(leccCALServices);
        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);
       
        if (logger.getNErrors() > 0) {
            List<CompilerMessage> messages = logger.getCompilerMessages();
            for (int i = 0, n = messages.size(); i < n; i++) {
                CompilerMessage message = messages.get(i);
                if (CompilerTestUtilities.isInternalCodingError(message.getMessageKind())) {
                     fail("Unexpected: " + message);
                }
View Full Code Here

                            //Make entry point specs - there will be numCompilationsPerThread unique
                            //entry point specs
                            EntryPointSpec spec =
                                EntryPointSpec.make(CAL_Prelude.Functions.add, new InputPolicy[] {
                                        InputPolicy.makeWithMarshaler(SourceModelUtilities.TextParsing.parseExprIntoSourceModel("add ("+j*2+"::Int) # Prelude.input ", new MessageLogger())),
                                        InputPolicy.DEFAULT_INPUT_POLICY},
                                        OutputPolicy.DEFAULT_OUTPUT_POLICY);

                            for(int k =0; k < numTimesToRun; k++) {
                                Integer addResult = (Integer) basicCalServices.runFunction(spec, new Integer[] {j, j/2});
View Full Code Here

       
        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);
           
            assertTrue(severity.compareTo(Severity.ERROR) < 0);

            //todo-jowong these assertions should be true, but are currently false because
View Full Code Here

        ModuleSourceDefinition[] moduleSourceDefns = { moduleSourceDefn1, moduleSourceDefn2 };
       
        ModuleSourceDefinitionGroup mdg = new ModuleSourceDefinitionGroup(moduleSourceDefns);

        try {
            CompilerMessageLogger logger = new MessageLogger();
            Severity severity = workspaceManager.makeModules(moduleNames, mdg, logger);
           
            assertTrue(severity.compareTo(Severity.ERROR) < 0);

            //todo-jowong these assertions should be true, but are currently false because
View Full Code Here

       
        ModuleSourceDefinition[] moduleSourceDefns = { moduleSourceDefn1, moduleSourceDefn2 };
       
        ModuleSourceDefinitionGroup mdg = new ModuleSourceDefinitionGroup(moduleSourceDefns);

        CompilerMessageLogger logger = new MessageLogger();
        Severity severity = workspaceManager.makeModules(moduleNames, mdg, logger);
       
        assertTrue(severity.compareTo(Severity.ERROR) < 0);
       
        Status status = new Status("Removal of test modules");
View Full Code Here

       
        String expectedValue = "Thread " + threadID + " iteration " + iterID;

        try {
            String functionName = "tempFunc" + threadID + "_" + iterID;
            CompilerMessageLogger logger = new MessageLogger();
           
            EntryPoint entryPoint = workspaceManager.getCompiler().getEntryPoint(
                new AdjunctSource.FromSourceModel(
                    SourceModel.FunctionDefn.Algebraic.make(
                        functionName, Scope.PRIVATE, null,
View Full Code Here

    private static void help_compileEvalDependentTestFunctionForThread(WorkspaceManager workspaceManager, ModuleName targetModule, String definingExpr, Object expectedValue, int threadID, int iterID, int numEvalTries, List asserts) {
       
        try {
            String functionName = "tempFunc" + threadID + "_" + iterID;
           
            CompilerMessageLogger logger = new MessageLogger();
           
            EntryPoint entryPoint = workspaceManager.getCompiler().getEntryPoint(
                new AdjunctSource.FromSourceModel(
                    SourceModel.FunctionDefn.Algebraic.make(
                        functionName, Scope.PRIVATE, null,
View Full Code Here

        for (int i = 0; i < numThreads; i++) {
            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++) {
                                help_compileEvalTestFunctionForThread(workspaceManager, moduleName, threadID, j, numEvalTries, assertList);
                               
                                for (int k = 0; k < numDependentModules; k++) {
View Full Code Here

            final int threadID = i;
            threads[i] = new Thread() {
                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);
View Full Code Here

TOP

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

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.