From 35a67f59001d2ebee33c45ebdd202162d5199d47 Mon Sep 17 00:00:00 2001 From: paulklint Date: Sun, 10 Mar 2024 19:53:39 +0100 Subject: [PATCH] Configuring the compiler made simpler The existing situation was that _and_ a TypePalConfig _and_ a CompilerConfig were needed to configure the typechecker and compiler. This has been replaced by a single RascalCompilerConfig (see lang::rascalcore::check::RascalConfig) that contains all configuration option both for the TypePal specific options and for the compiler-specific options. As a result, there is a single place for options, and the signatures of several functions could be simplified. --- .../core/library/CheckTestSources.rsc | 10 ++- .../core/library/CompileTestSources.rsc | 13 ++-- .../core/library/GenerateTestSources.rsc | 10 +-- .../rascalcore/check/BasicRascalConfig.rsc | 22 ++++++- .../library/lang/rascalcore/check/Checker.rsc | 66 +++++++++---------- .../library/lang/rascalcore/check/Import.rsc | 6 +- .../lang/rascalcore/check/RascalConfig.rsc | 53 ++++++++++----- .../check/tests/StaticTestingUtils.rsc | 4 +- .../lang/rascalcore/compile/Compile.rsc | 20 +++--- .../compile/Rascal2muRascal/ModuleInfo.rsc | 2 +- .../compile/Rascal2muRascal/RascalModule.rsc | 2 +- 11 files changed, 121 insertions(+), 87 deletions(-) diff --git a/src/org/rascalmpl/core/library/CheckTestSources.rsc b/src/org/rascalmpl/core/library/CheckTestSources.rsc index c2780843..ee12e33c 100644 --- a/src/org/rascalmpl/core/library/CheckTestSources.rsc +++ b/src/org/rascalmpl/core/library/CheckTestSources.rsc @@ -31,7 +31,7 @@ void checkTestSources(PathConfig pcfg) { println("PathConfig for type checking test sources:\n"); iprintln(testConfig); - testCompilerConfig = getRascalCompilerConfig(); + testCompilerConfig = rascalCompilerConfig(testConfig); total = 0; println(readFile(|lib://rascal/META-INF/MANIFEST.MF|)); @@ -82,7 +82,7 @@ void checkTestSources(PathConfig pcfg) { "analysis::m3::TypeSymbol"]; for (m <- libraryModules) { - = safeCompile(m, testConfig, testCompilerConfig); + = safeCompile(m, testCompilerConfig); total += d; } @@ -101,7 +101,7 @@ void checkTestSources(PathConfig pcfg) { for (i <- index(testModules)) { m = testModules[i]; println("Checking test module [/]"); - = safeCompile(m, testConfig, testCompilerConfig); + = safeCompile(m, testCompilerConfig); total += d; if(!isEmpty(e)){ exceptions += e; @@ -114,13 +114,11 @@ void checkTestSources(PathConfig pcfg) { println("Time: seconds"); } -tuple[str, int] safeCompile(str \module, PathConfig pcfg, CompilerConfig compilerConfig) { +tuple[str, int] safeCompile(str \module, RascalCompilerConfig compilerConfig) { start_time = cpuTime(); try { - println("checking <\module>"); ModuleStatus result = rascalTModelForNames([\module], - rascalTypePalConfig(pcfg), compilerConfig, dummy_compile1); iprintln(result.tmodels[\module].messages); diff --git a/src/org/rascalmpl/core/library/CompileTestSources.rsc b/src/org/rascalmpl/core/library/CompileTestSources.rsc index b85ba1bc..f1fbb047 100644 --- a/src/org/rascalmpl/core/library/CompileTestSources.rsc +++ b/src/org/rascalmpl/core/library/CompileTestSources.rsc @@ -36,7 +36,7 @@ void compileTestSources(PathConfig pcfg) { println("PathConfig for compiling test sources:\n"); iprintln(testConfig); - testCompilerConfig = getRascalCompilerConfig(); + testCompilerConfig = rascalCompilerConfig(testConfig); total = 0; println(readFile(|lib://rascal/META-INF/MANIFEST.MF|)); @@ -121,7 +121,7 @@ void compileTestSources(PathConfig pcfg) { for (m <- libraryModules) { - = safeCompile(m, testConfig, testCompilerConfig); + = safeCompile(m, testCompilerConfig); total += d; } @@ -145,7 +145,7 @@ void compileTestSources(PathConfig pcfg) { for (i <- index(testModules)) { m = testModules[i]; println("Compiling test module [/]"); - = safeCompile(m, testConfig, testCompilerConfig); + = safeCompile(m, testCompilerConfig); total += d; if(!isEmpty(e)){ exceptions += e; @@ -158,11 +158,10 @@ void compileTestSources(PathConfig pcfg) { println("Time: seconds"); } -tuple[str, int] safeCompile(str \module, PathConfig pcfg, CompilerConfig compilerConfig) { +tuple[str, int] safeCompile(str \module, RascalCompilerConfig compilerConfig) { start_time = cpuTime(); - try { - println("compiling <\module>"); - compile(\module, pcfg, compilerConfig); + try { + compile(\module, compilerConfig); return <"",cpuTime()-start_time>; } catch value exception: { diff --git a/src/org/rascalmpl/core/library/GenerateTestSources.rsc b/src/org/rascalmpl/core/library/GenerateTestSources.rsc index 7ff161fd..4fc92fe9 100644 --- a/src/org/rascalmpl/core/library/GenerateTestSources.rsc +++ b/src/org/rascalmpl/core/library/GenerateTestSources.rsc @@ -27,7 +27,7 @@ void generateTestSources(PathConfig pcfg) { libs = [ ] ); - testCompilerConfig = getRascalCompilerConfig(); + testCompilerConfig = getRascalCompilerConfigForDev(testConfig); map[str,int] durations = (); @@ -118,7 +118,7 @@ void generateTestSources(PathConfig pcfg) { for (m <- libraryModules) { - safeCompile(m, testConfig, testCompilerConfig, (int d) { durations[m] = d; }); + safeCompile(m, testCompilerConfig, (int d) { durations[m] = d; }); } //for (m <- checkerTestModules) { @@ -140,7 +140,7 @@ void generateTestSources(PathConfig pcfg) { for (i <- index(testModules)) { m = testModules[i]; println("Compiling test module [/]"); - e = safeCompile(m, testConfig, testCompilerConfig, (int d) { durations[m] = d; }); + e = safeCompile(m, testCompilerConfig, (int d) { durations[m] = d; }); if(!isEmpty(e)){ exceptions += e; } @@ -153,10 +153,10 @@ void generateTestSources(PathConfig pcfg) { //iprintln(sort({ | m <- durations}, bool (<_,int i>, <_, int j>) { return i < j; })); } -str safeCompile(str \module, PathConfig pcfg, CompilerConfig compilerConfig, void (int duration) measure) { +str safeCompile(str \module, RascalCompilerConfig compilerConfig, void (int duration) measure) { try { measure(cpuTimeOf(() { - compile(\module, pcfg, compilerConfig); + compile(\module, compilerConfig); })); return ""; } diff --git a/src/org/rascalmpl/core/library/lang/rascalcore/check/BasicRascalConfig.rsc b/src/org/rascalmpl/core/library/lang/rascalcore/check/BasicRascalConfig.rsc index 5ac8db1b..db8a08d6 100644 --- a/src/org/rascalmpl/core/library/lang/rascalcore/check/BasicRascalConfig.rsc +++ b/src/org/rascalmpl/core/library/lang/rascalcore/check/BasicRascalConfig.rsc @@ -105,11 +105,29 @@ public str key_grammar = "grammar"; public str key_ADTs = "ADTs"; public str key_common_keyword_fields = "CommonKeywordFields"; +// Define alias for TypePalConfig + +alias RascalCompilerConfig = TypePalConfig; + +// Add keyword parameters to a TypePalConfig to represent compiler settings +// Also see lang::rascalcore::check::RascalConfig + data TypePalConfig( - bool logImports = true, + // Control message level bool warnUnused = true, bool warnUnusedFormals = true, bool warnUnusedVariables = true, bool warnUnusedPatternFormals = true, - bool warnDeprecated = false + bool warnDeprecated = false, + + loc reloc = |noreloc:///|, // Unused + + // Debugging options + bool verbose = true, // for each compiled module, print PathConfig, module name and compilation time + bool logImports = false, // log all imported files + bool logWrittenFiles = false, // log all files written by compiler + + bool optimizeVisit = true, // Options for compiler developer + bool enableAsserts = true, + bool forceCompilationTopModule = false ); diff --git a/src/org/rascalmpl/core/library/lang/rascalcore/check/Checker.rsc b/src/org/rascalmpl/core/library/lang/rascalcore/check/Checker.rsc index 2fc33cc6..e7be2322 100644 --- a/src/org/rascalmpl/core/library/lang/rascalcore/check/Checker.rsc +++ b/src/org/rascalmpl/core/library/lang/rascalcore/check/Checker.rsc @@ -55,8 +55,6 @@ data PathConfig( loc resources = |unknown:///|, loc testResources =|unknown:///| ); - -Tree mkTree(int n) = [DecimalIntegerLiteral] "6<}>"; // Create a unique tree to identify predefined names void rascalPreCollectInitialization(map[str, Tree] namedTrees, Collector c){ @@ -130,6 +128,14 @@ public PathConfig getRascalCorePathConfig() { libs = [] ); } + +public RascalCompilerConfig getRascalCoreCompilerConfig(){ + return rascalCompilerConfig(getRascalCorePathConfig())[verbose = true][forceCompilationTopModule = true][logWrittenFiles = true]; +} + +public RascalCompilerConfig getRascalCompilerConfigForDev(PathConfig pcfg){ + return rascalCompilerConfig(pcfg); +} @synopsis{a path config for testing type-checking of the standard library in the rascal project} public PathConfig getRascalProjectPathConfig() { @@ -142,9 +148,6 @@ public PathConfig getRascalProjectPathConfig() { ); } -CompilerConfig getRascalCompilerConfig() - = cconfig(); - list[Message] validatePathConfigForCompiler(PathConfig pcfg, loc mloc){ msgs = []; @@ -187,14 +190,11 @@ list[Message] validatePathConfigForCompiler(PathConfig pcfg, loc mloc){ // rascalTModelForLocs is the basic work horse ModuleStatus rascalTModelForLocs( - list[loc] mlocs, - TypePalConfig config, - CompilerConfig compilerConfig, - list[Message](str qualifiedModuleName, lang::rascal::\syntax::Rascal::Module M, ModuleStatus ms, CompilerConfig compilerConfig) codgen -){ - bool forceCompilationTopModule = false; /***** for convenience, set to true during development of type checker *****/ - - pcfg = config.typepalPathConfig; + list[loc] mlocs, + RascalCompilerConfig compilerConfig, + list[Message](str qualifiedModuleName, lang::rascal::\syntax::Rascal::Module M, ModuleStatus ms, RascalCompilerConfig compilerConfig) codgen +){ + pcfg = compilerConfig.typepalPathConfig; if(compilerConfig.verbose) iprintln(pcfg); msgs = validatePathConfigForCompiler(pcfg, mlocs[0]); @@ -218,7 +218,7 @@ ModuleStatus rascalTModelForLocs( try { ms = getImportAndExtendGraph(topModuleNames, pcfg); - if(forceCompilationTopModule){ + if(compilerConfig.forceCompilationTopModule){ for(str nm <- topModuleNames){ ms.status[nm] = {}; } @@ -265,7 +265,7 @@ ModuleStatus rascalTModelForLocs( } } if(!all(m <- component, tpl_uptodate() in ms.status[m] || checked() in ms.status[m])){ - = rascalTModelComponent(component, ms, config); + = rascalTModelComponent(component, ms, compilerConfig); moduleScopes += getModuleScopes(tm); map[str,TModel] tmodels_for_component = (); map[str,set[str]] m_imports = (); @@ -276,7 +276,7 @@ ModuleStatus rascalTModelForLocs( extends = { ext | <- ms.strPaths, m1 == m }; m_extends[m] = extends; invertedExtends = ms.strPaths<2,0>; - if(config.warnUnused){ + if(compilerConfig.warnUnused){ // Look for unused imports or exports usedModules = {path2module[l.path] | loc l <- range(tm.useDef), tm.definitions[l].idRole != moduleId(), path2module[l.path]?}; usedModules += {*invertedExtends[um] | um <- usedModules}; // use of an extended module via import @@ -384,7 +384,7 @@ tuple[set[str], ModuleStatus] loadImportsAndExtends(str moduleName, ModuleStatus return ; } -tuple[TModel, ModuleStatus] rascalTModelComponent(set[str] moduleNames, ModuleStatus ms, TypePalConfig config){ +tuple[TModel, ModuleStatus] rascalTModelComponent(set[str] moduleNames, ModuleStatus ms, RascalCompilerConfig compilerConfig){ pcfg = ms.pathConfig; modelName = intercalate(" + ", toList(moduleNames)); @@ -398,10 +398,10 @@ tuple[TModel, ModuleStatus] rascalTModelComponent(set[str] moduleNames, ModuleSt } } jobStart("RascalCompiler"); - jobStep("RascalCompiler", "Type checking "); // TODO: monitor - if(config.verbose) println("Type checking "); + jobStep("RascalCompiler", "Checking "); // TODO: monitor + if(compilerConfig.verbose) println("Checking "); - c = newCollector(modelName, namedTrees, config); + c = newCollector(modelName, namedTrees, compilerConfig); c.push(key_pathconfig, pcfg); rascalPreCollectInitialization(namedTrees, c); @@ -428,12 +428,11 @@ tuple[TModel, ModuleStatus] rascalTModelComponent(set[str] moduleNames, ModuleSt // ---- rascalTModelForName a checker version that works on module names ModuleStatus rascalTModelForNames(list[str] moduleNames, - TypePalConfig config, - CompilerConfig compilerConfig, - list[Message] (str qualifiedModuleName, lang::rascal::\syntax::Rascal::Module M, ModuleStatus ms, CompilerConfig compilerConfig) codgen){ + RascalCompilerConfig compilerConfig, + list[Message] (str qualifiedModuleName, lang::rascal::\syntax::Rascal::Module M, ModuleStatus ms, RascalCompilerConfig compilerConfig) codgen){ - pcfg = config.typepalPathConfig; + pcfg = compilerConfig.typepalPathConfig; mlocs = []; for(moduleName <- moduleNames){ try { @@ -445,7 +444,7 @@ ModuleStatus rascalTModelForNames(list[str] moduleNames, return ms; } } - return rascalTModelForLocs(mlocs, config, compilerConfig, codgen); + return rascalTModelForLocs(mlocs, compilerConfig, codgen); } // ---- checker functions for IDE @@ -453,24 +452,25 @@ ModuleStatus rascalTModelForNames(list[str] moduleNames, // name of the production has to mirror the Kernel compile result data ModuleMessages = program(loc src, set[Message] messages); -list[Message] dummy_compile1(str _qualifiedModuleName, lang::rascal::\syntax::Rascal::Module _M, ModuleStatus _ms, CompilerConfig _compilerConfig) +list[Message] dummy_compile1(str _qualifiedModuleName, lang::rascal::\syntax::Rascal::Module _M, ModuleStatus _ms, RascalCompilerConfig _compilerConfig) = []; -list[ModuleMessages] check(list[loc] moduleLocs, PathConfig pcfg, CompilerConfig compilerConfig){ - pcfg1 = pcfg; pcfg1.classloaders = []; pcfg1.javaCompilerPath = []; +list[ModuleMessages] check(list[loc] moduleLocs, RascalCompilerConfig compilerConfig){ + pcfg1 = compilerConfig.typepalPathConfig; pcfg1.classloaders = []; pcfg1.javaCompilerPath = []; + compilerConfig.typepalPathConfig = pcfg1; //println("=== check: "); iprintln(pcfg1); - ms = rascalTModelForLocs(moduleLocs, rascalTypePalConfig(pcfg), compilerConfig, dummy_compile1); + ms = rascalTModelForLocs(moduleLocs, compilerConfig, dummy_compile1); return [ program(ms.moduleLocs[mname], toSet(ms.messages[mname])) | mname <- ms.messages ]; } -list[ModuleMessages] checkAll(loc root, PathConfig pcfg, CompilerConfig compilerConfig){ - return check(toList(find(root, "rsc")), pcfg, compilerConfig); +list[ModuleMessages] checkAll(loc root, RascalCompilerConfig compilerConfig){ + return check(toList(find(root, "rsc")), compilerConfig); } // ---- Convenience check function during development ------------------------- -map[str, list[Message]] checkModules(list[str] moduleNames, TypePalConfig config, PathConfig pcfg, bool verbose=true) { - ModuleStatus ms = rascalTModelForNames(moduleNames, config, getRascalCompilerConfig()[verbose=verbose], dummy_compile1); +map[str, list[Message]] checkModules(list[str] moduleNames, RascalCompilerConfig compilerConfig) { + ModuleStatus ms = rascalTModelForNames(moduleNames, compilerConfig, dummy_compile1); tmodels = ms.tmodels; return (mname : tmodels[mname].messages | mname <- tmodels, !isEmpty(tmodels[mname].messages)); } diff --git a/src/org/rascalmpl/core/library/lang/rascalcore/check/Import.rsc b/src/org/rascalmpl/core/library/lang/rascalcore/check/Import.rsc index 161df4b5..9a5d3102 100644 --- a/src/org/rascalmpl/core/library/lang/rascalcore/check/Import.rsc +++ b/src/org/rascalmpl/core/library/lang/rascalcore/check/Import.rsc @@ -192,8 +192,8 @@ tuple[bool, TModel, ModuleStatus] getTModelForModule(str qualifiedModuleName, Mo ms.tmodels[qualifiedModuleName] = tpl; ms.status[qualifiedModuleName] += {tpl_uptodate(), tpl_saved()}; return ; - } catch _: - return ; + } catch e: + return : ", tplLoc)]), ms>; //throw IO("Cannot read tpl for : "); } //if(qualifiedModuleName notin hardwired){ @@ -439,7 +439,7 @@ ModuleStatus preSaveModule(set[str] component, map[str,set[str]] m_imports, map[ return ms; } -ModuleStatus doSaveModule(set[str] component, map[str,set[str]] m_imports, map[str,set[str]] m_extends, ModuleStatus ms, map[str,loc] moduleScopes, CompilerConfig compilerConfig){ +ModuleStatus doSaveModule(set[str] component, map[str,set[str]] m_imports, map[str,set[str]] m_extends, ModuleStatus ms, map[str,loc] moduleScopes, RascalCompilerConfig compilerConfig){ map[str,datetime] moduleLastModified = ms.moduleLastModified; pcfg = ms.pathConfig; //println("doSaveModule: , , , "); diff --git a/src/org/rascalmpl/core/library/lang/rascalcore/check/RascalConfig.rsc b/src/org/rascalmpl/core/library/lang/rascalcore/check/RascalConfig.rsc index bdd885a4..2d8103d4 100644 --- a/src/org/rascalmpl/core/library/lang/rascalcore/check/RascalConfig.rsc +++ b/src/org/rascalmpl/core/library/lang/rascalcore/check/RascalConfig.rsc @@ -422,20 +422,45 @@ loc rascalCreateLogicalLoc(Define def, str modelName, PathConfig pcfg){ return def.defined; } -TypePalConfig rascalTypePalConfig(PathConfig rascalPathConfig, - bool logImports = false +RascalCompilerConfig rascalCompilerConfig(PathConfig pcfg, + // Control message levels + bool warnUnused = true, + bool warnUnusedFormals = true, + bool warnUnusedVariables = true, + bool warnUnusedPatternFormals = true, + bool warnDeprecated = false, + + // Debugging + bool verbose = true, // for each compiled module, print PathConfig, module name and compilation time + bool logImports = false, + bool logWrittenFiles = false, // print location of written files: .constants, .tpl, *.java + + loc reloc = |noreloc:///|, // Currently unused + + bool optimizeVisit = true, // Options for compiler developer + bool enableAsserts = true, + bool forceCompilationTopModule = false ) = tconfig( - logImports = logImports, + // Compiler options + warnUnused = warnUnused, + warnUnusedFormals = warnUnusedFormals, + warnUnusedFormals = warnUnusedFormals, + warnUnusedPatternFormals = warnUnusedPatternFormals, + warnUnusedPatternFormals = warnUnusedPatternFormals, - typepalPathConfig = rascalPathConfig, - - warnUnused = true, - warnUnusedFormals = true, - warnUnusedVariables = true, - warnUnusedPatternFormals = true, - warnDeprecated = false, + verbose = verbose, + logImports = logImports, + logWrittenFiles = logWrittenFiles, + reloc = reloc, + optimizeVisit = optimizeVisit, + enableAsserts = enableAsserts, + forceCompilationTopModule = forceCompilationTopModule, + + // Basic TypePalConfig options + typepalPathConfig = pcfg, + getMinAType = AType(){ return avoid(); }, getMaxAType = AType(){ return avalue(); }, isSubType = asubtype, @@ -458,11 +483,3 @@ TypePalConfig rascalTypePalConfig(PathConfig rascalPathConfig, reportUnused = rascalReportUnused, createLogicalLoc = rascalCreateLogicalLoc ); - - data CompilerConfig( - loc reloc = |noreloc:///|, - bool verbose = true, // for each compiled module, print PathConfig, module name and compilation time - bool optimizeVisit = true, - bool enableAsserts = true, - bool logWrittenFiles = true // print location of written files: .constants, .tpl, *.java - ) = cconfig(); diff --git a/src/org/rascalmpl/core/library/lang/rascalcore/check/tests/StaticTestingUtils.rsc b/src/org/rascalmpl/core/library/lang/rascalcore/check/tests/StaticTestingUtils.rsc index b420ec13..a916e5eb 100644 --- a/src/org/rascalmpl/core/library/lang/rascalcore/check/tests/StaticTestingUtils.rsc +++ b/src/org/rascalmpl/core/library/lang/rascalcore/check/tests/StaticTestingUtils.rsc @@ -62,7 +62,7 @@ set[Message] getAllMessages(ModuleStatus r) ModuleStatus checkStatements(str stmts, list[str] importedModules = [], list[str] initialDecls = [], bool verbose=true){ mloc = buildModule(stmts, importedModules=importedModules, initialDecls=initialDecls); - return rascalTModelForLocs([mloc], rascalTypePalConfig(pathConfigForTesting()), getRascalCompilerConfig(), dummy_compile1); + return rascalTModelForLocs([mloc], rascalCompilerConfig(pathConfigForTesting()), dummy_compile1); } bool check(str stmts, list[str] expected, list[str] importedModules = [], list[str] initialDecls = []){ @@ -87,7 +87,7 @@ bool checkOK(str stmts, list[str] importedModules = [], list[str] initialDecls = } bool checkModuleOK(loc moduleToCheck){ - errors = getErrorMessages(rascalTModelForLocs([moduleToCheck], rascalTypePalConfig(pathConfigForTesting()), getRascalCompilerConfig(), dummy_compile1)); + errors = getErrorMessages(rascalTModelForLocs([moduleToCheck], rascalCompilerConfig(pathConfigForTesting()), dummy_compile1)); if(size(errors) == 0) return true; throw abbrev(""); diff --git a/src/org/rascalmpl/core/library/lang/rascalcore/compile/Compile.rsc b/src/org/rascalmpl/core/library/lang/rascalcore/compile/Compile.rsc index 8f0fb3ed..cb5018a9 100644 --- a/src/org/rascalmpl/core/library/lang/rascalcore/compile/Compile.rsc +++ b/src/org/rascalmpl/core/library/lang/rascalcore/compile/Compile.rsc @@ -29,7 +29,7 @@ bool errorsPresent(list[Message] msgs) = !isEmpty([ e | e:error(_,_) <- msgs ]); data ModuleStatus; -list[Message] compile1(str qualifiedModuleName, lang::rascal::\syntax::Rascal::Module M, ModuleStatus ms, CompilerConfig compilerConfig){ +list[Message] compile1(str qualifiedModuleName, lang::rascal::\syntax::Rascal::Module M, ModuleStatus ms, RascalCompilerConfig compilerConfig){ pcfg = ms.pathConfig; = getTModelForModule(qualifiedModuleName, ms); @@ -53,8 +53,8 @@ list[Message] compile1(str qualifiedModuleName, lang::rascal::\syntax::Rascal::M return tm.messages; } - jobStep("RascalCompiler", ": compiling");// TODO: monitor - if(compilerConfig.verbose) println(": compiling"); + jobStep("RascalCompiler", "Compiling ");// TODO: monitor + if(compilerConfig.verbose) println("Compiling "); = r2mu(M, tm, compilerConfig); @@ -89,8 +89,9 @@ list[Message] compile1(str qualifiedModuleName, lang::rascal::\syntax::Rascal::M } @doc{Compile a Rascal source module (given at a location) to Java} -list[Message] compile(loc moduleLoc, PathConfig pcfg, CompilerConfig compilerConfig) { +list[Message] compile(loc moduleLoc, RascalCompilerConfig compilerConfig) { + pcfg = compilerConfig.typepalPathConfig; msgs = validatePathConfigForCompiler(pcfg, moduleLoc); if(!isEmpty(msgs)){ return msgs; @@ -101,11 +102,12 @@ list[Message] compile(loc moduleLoc, PathConfig pcfg, CompilerConfig compilerCon } catch str e: { return [ error("Cannot find name for location, reason: ", moduleLoc) ]; } - return compile(moduleName, pcfg, compilerConfig); + return compile(moduleName, compilerConfig); } @doc{Compile a Rascal source module (given as qualifiedModuleName) to Java} -list[Message] compile(str qualifiedModuleName, PathConfig pcfg, CompilerConfig compilerConfig){ +list[Message] compile(str qualifiedModuleName, RascalCompilerConfig compilerConfig){ + pcfg = compilerConfig.typepalPathConfig; msgs = validatePathConfigForCompiler(pcfg, |unknown:///|); if(!isEmpty(msgs)){ return msgs; @@ -113,14 +115,14 @@ list[Message] compile(str qualifiedModuleName, PathConfig pcfg, CompilerConfig c jobStart("RascalCompiler");// TODO: monitor start_comp = cpuTime(); - ms = rascalTModelForNames([qualifiedModuleName], rascalTypePalConfig(pcfg), compilerConfig, compile1); + ms = rascalTModelForNames([qualifiedModuleName], compilerConfig, compile1); comp_time = (cpuTime() - start_comp)/1000000; - jobStep("RascalCompiler", ": compiled in ms");// TODO: monitor + jobStep("RascalCompiler", "Compiled in ms");// TODO: monitor jobEnd("RascalCompiler");// TODO: monitor - if(compilerConfig.verbose) println(": compiled in ms"); + if(compilerConfig.verbose) println("Compiled in ms"); return ms.messages[qualifiedModuleName] ? []; } \ No newline at end of file diff --git a/src/org/rascalmpl/core/library/lang/rascalcore/compile/Rascal2muRascal/ModuleInfo.rsc b/src/org/rascalmpl/core/library/lang/rascalcore/compile/Rascal2muRascal/ModuleInfo.rsc index 1a8fb613..ecfb77d8 100644 --- a/src/org/rascalmpl/core/library/lang/rascalcore/compile/Rascal2muRascal/ModuleInfo.rsc +++ b/src/org/rascalmpl/core/library/lang/rascalcore/compile/Rascal2muRascal/ModuleInfo.rsc @@ -107,7 +107,7 @@ public list[MuExp] getVariableInitializationsInModule(){ // Reset global state -void resetModuleInfo(CompilerConfig compilerConfig) { +void resetModuleInfo(RascalCompilerConfig compilerConfig) { optimizingVisit = compilerConfig.optimizeVisit; enablingAsserts = compilerConfig.enableAsserts; diff --git a/src/org/rascalmpl/core/library/lang/rascalcore/compile/Rascal2muRascal/RascalModule.rsc b/src/org/rascalmpl/core/library/lang/rascalcore/compile/Rascal2muRascal/RascalModule.rsc index 875b7893..ad9ebda3 100644 --- a/src/org/rascalmpl/core/library/lang/rascalcore/compile/Rascal2muRascal/RascalModule.rsc +++ b/src/org/rascalmpl/core/library/lang/rascalcore/compile/Rascal2muRascal/RascalModule.rsc @@ -39,7 +39,7 @@ import lang::rascalcore::compile::Rascal2muRascal::RascalExpression; /********************************************************************/ @doc{Compile a parsed Rascal source module to muRascal} -tuple[TModel, MuModule] r2mu(lang::rascal::\syntax::Rascal::Module M, TModel tmodel, CompilerConfig compilerConfig){ +tuple[TModel, MuModule] r2mu(lang::rascal::\syntax::Rascal::Module M, TModel tmodel, RascalCompilerConfig compilerConfig){ try { resetModuleInfo(compilerConfig); module_scope = M@\loc;