diff --git a/compiler/DeclNames.jrag b/compiler/DeclNames.jrag new file mode 100644 index 0000000000000000000000000000000000000000..4e58087cd269406ec4db3970c7cf90a8f2242051 --- /dev/null +++ b/compiler/DeclNames.jrag @@ -0,0 +1,7 @@ +aspect DeclNames { + inh String Type.declName(); + eq Decl.getType().declName() = getName(); + + inh String Field.declName(); + eq StructType.getField(int i).declName() = declName(); +} diff --git a/compiler/LabComm.java b/compiler/LabComm.java index c1c7251f9bb622b617d6acf5a1005c6d05eb581d..c86125a5c17df193402c526d6f2d688602632c35 100644 --- a/compiler/LabComm.java +++ b/compiler/LabComm.java @@ -249,6 +249,10 @@ public class LabComm { if (prettyOnStdout) { ast.pp(System.out); } + } else { + // Catch-all for compilation errors + System.err.println("Error in specification"); + System.exit(3); } } } diff --git a/compiler/TypeCheck.jrag b/compiler/TypeCheck.jrag index 747d830e304d4995b97cd256884a5a0456d2545b..a640ace5098013bef6cad31767a96220aa66b8a7 100644 --- a/compiler/TypeCheck.jrag +++ b/compiler/TypeCheck.jrag @@ -18,19 +18,19 @@ aspect TypeCheck { public void Field.nullTypeCheck() { if(getType().isNull()) { - error("field " + getName() + " may not be of type void"); + error("field " + getName() + " of struct "+ declName()+ " may not be of type void"); } } public void ParseArrayType.nullTypeCheck() { if(getType().isNull()) { - error("array elements may not be of type void"); + error("elements of array "+declName()+" may not be of type void"); } } public void ArrayType.nullTypeCheck() { if(getType().isNull()) { - error("array elements may not be of type void"); + error("elements of array "+declName()+" may not be of type void"); } } }