Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
e56974f
Major adaptation to logical ModuleLocations
PaulKlint Jan 5, 2026
2719929
Updated TypePal dependency
PaulKlint Jan 5, 2026
a6d85c4
Fixed two minor errors
PaulKlint Jan 5, 2026
4c797a1
Added (for bootstrapping reasons) a copy of LogicallLocations
PaulKlint Jan 6, 2026
86596ec
Moved contents of LogicalLocation to Location
PaulKlint Jan 6, 2026
d658d26
Forgot to remove old LogicalLocation file
PaulKlint Jan 6, 2026
e35e4e9
Merge branch 'main' into native-logical-locs
PaulKlint Jan 6, 2026
abe0b17
Fixed error in typepal dependency
PaulKlint Jan 6, 2026
c63510b
Exclude target from search
PaulKlint Jan 6, 2026
505d06c
Revert "Exclude target from search"
PaulKlint Jan 6, 2026
39f5f4a
Bumped typepal version
PaulKlint Jan 6, 2026
ecde7f7
Started propagating switch to logical locations to remainder of compiler
PaulKlint Jan 7, 2026
d255f53
Updated TypePal dependency
PaulKlint Jan 7, 2026
074ca0b
Removed duplicate license
PaulKlint Jan 8, 2026
9537179
Fixed error in filterOverloads related to varargs and constructors
PaulKlint Jan 8, 2026
c30d403
Show physical locs in messages
PaulKlint Jan 8, 2026
6b68b80
Fixed type error
PaulKlint Jan 9, 2026
778d915
Removed warnings
PaulKlint Jan 9, 2026
65ab24d
Minor cleanup
PaulKlint Jan 9, 2026
963c98b
Removed warnings
PaulKlint Jan 9, 2026
1674ccf
Started adapting backend
PaulKlint Jan 9, 2026
4d4c849
Optimizing tpl file saving
PaulKlint Jan 9, 2026
8838f1a
Introduced new kinds of logical locations in separate module
PaulKlint Jan 10, 2026
428ffed
Some renamings; undone early changes to backend
PaulKlint Jan 10, 2026
a0282b3
Merge branch 'main' into native-logical-locs
PaulKlint Jan 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@
<dependency>
<groupId>org.rascalmpl</groupId>
<artifactId>typepal</artifactId>
<version>0.15.3</version>
<version>0.16.0-RC2</version>
<!-- <scope>provided</scope> for shade plugin it can't be provided. At least the rascal dependency in typepal should be provided -->
<scope>compile</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,19 +165,20 @@ list[&T <: node ] unsetRec(list[&T <: node] args) = [unsetRec(a) | a <- args];

bool isManualLayout(AProduction p) = (p has attributes && atag("manual"()) in p.attributes);

tuple[TModel, ModuleStatus] addGrammar(str qualifiedModuleName, set[str] imports, set[str] extends, map[str,TModel] transient_tms, ModuleStatus ms){
tuple[TModel, ModuleStatus] addGrammar(MODID moduleId, set[MODID] imports, set[MODID] extends, map[MODID,TModel] transient_tms, ModuleStatus ms){
try {
rel[AType,AProduction] definedProductions = {};
allStarts = {};
for(m <- {qualifiedModuleName, *imports, *extends}){
qualifiedModuleName = moduleId2moduleName(moduleId);
for(m <- {moduleId, *imports, *extends}){
TModel tm1;
if(transient_tms[m]?){
tm1 = transient_tms[m];
} else {
<found, tm1, ms> = getTModelForModule(m, ms);
if(!found) {
msg = error("Cannot add grammar, tmodel for <m> not found", ms.moduleLocs[qualifiedModuleName] ? |unknown:///|);
ms.messages[qualifiedModuleName] ? {} += { msg };
msg = error("Cannot add grammar, tmodel for <m> not found", ms.moduleLocs[moduleId] ? |unknown:///|);
ms.messages[moduleId] ? {} += { msg };
tm1 = tmodel(modelName=qualifiedModuleName, messages=[msg]);
return <tm1, ms>;
}
Expand Down Expand Up @@ -223,7 +224,7 @@ tuple[TModel, ModuleStatus] addGrammar(str qualifiedModuleName, set[str] imports

// Check keyword rules

tm = checkKeywords(allProductions, transient_tms[qualifiedModuleName]);
tm = checkKeywords(allProductions, transient_tms[moduleId]);

// Check layout

Expand Down
13 changes: 1 addition & 12 deletions src/org/rascalmpl/compiler/lang/rascalcore/check/ATypeUtils.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,6 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
}
@license{
Copyright (c) 2009-2015 CWI
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html
}
@contributor{Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI}
@contributor{Mark Hills - Mark.Hills@cwi.nl (CWI)}
@contributor{Paul Klint - Paul.Klint@cwi.nl (CWI)}
@contributor{Anastasia Izmaylova - Anastasia.Izmaylova@cwi.nl (CWI)}
@bootstrapParser
module lang::rascalcore::check::ATypeUtils

Expand Down Expand Up @@ -366,7 +355,7 @@ AType symbol2atype1(Symbol::\cons(Symbol \adt, str name, list[Symbol] parameters
AType symbol2atype1(Symbol::sort(str name)) = aadt(name, [], contextFreeSyntax());
AType symbol2atype1(Symbol::lex(str name)) = aadt(name, [], lexicalSyntax());
AType symbol2atype1(Symbol::keywords(str name)) = aadt(name, [], keywordSyntax());
AType symbol2atype1(Symbol::layouts(str name)) = AType::layouts(name);
AType symbol2atype1(Symbol::layouts(str name)) = aadt(name, [], layoutSyntax());

AType symbol2atype1(Symbol::\parameterized-sort(str name, list[Symbol] parameters)) =
aadt(name, symbol2atype(parameters), contextFreeSyntax());
Expand Down
208 changes: 109 additions & 99 deletions src/org/rascalmpl/compiler/lang/rascalcore/check/Checker.rsc

Large diffs are not rendered by default.

328 changes: 150 additions & 178 deletions src/org/rascalmpl/compiler/lang/rascalcore/check/CheckerCommon.rsc

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -750,10 +750,27 @@ void reportMissingNonTerminalCases(Expression current, rel[loc def, IdRole idRol
// }

private tuple[rel[loc, IdRole, AType], list[bool]] filterOverloads(rel[loc, IdRole, AType] overloads, int arity){
// println("filterOverloads: <overloads>, <arity>");
rel[loc, IdRole, AType] filteredOverloads = {};
list[AType] prevFormals = [];
list[bool] identicalFormals = [true | int _ <- [0 .. arity]];

// Filter constructors first to avoid issues with vararg functions
for(ovl:<_, _, tp> <- overloads){
if(acons(aadt(_, list[AType] _,_), list[AType] fields, list[Keyword] _) := tp){
if(size(fields) == arity){
filteredOverloads += ovl;
if(isEmpty(prevFormals)){
prevFormals = fields; //<1>;
} else {
for(int i <- index(fields)) {
identicalFormals[i] = identicalFormals[i] && (comparable(prevFormals[i], fields[i]/*.fieldType*/));
}
}
}
}
}

for(ovl:<_, _, tp> <- overloads){
if(ft:afunc(AType _, list[AType] formals, list[Keyword] _) := tp){
if(ft.varArgs ? (arity >= size(formals) - 1) : (arity == size(formals))) {
Expand All @@ -769,18 +786,7 @@ private tuple[rel[loc, IdRole, AType], list[bool]] filterOverloads(rel[loc, IdRo
}
}
}
else if(acons(aadt(_, list[AType] _,_), list[AType] fields, list[Keyword] _) := tp){
if(size(fields) == arity){
filteredOverloads += ovl;
if(isEmpty(prevFormals)){
prevFormals = fields; //<1>;
} else {
for(int i <- index(fields)) {
identicalFormals[i] = identicalFormals[i] && (comparable(prevFormals[i], fields[i]/*.fieldType*/));
}
}
}
}

}
return <filteredOverloads, identicalFormals>;
}
Expand Down
Loading
Loading