--- compiler/parser/sourcereader.cpp~	2016-06-14 12:44:43.904994214 +0200
+++ compiler/parser/sourcereader.cpp	2016-06-14 12:58:43.520113689 +0200
@@ -83,24 +83,38 @@
 	return true;
 }
 
-static string printPatternError(Tree lhs1, Tree rhs1, Tree lhs2, Tree rhs2)
+static string printPatternError(Tree symbol, Tree lhs1, Tree rhs1, Tree lhs2, Tree rhs2)
 {
-    stringstream error;
-	error 	<< "ERROR : inconsistent number of parameters in pattern-matching rule: "
-    << boxpp(reverse(lhs2)) << " => " << boxpp(rhs2) << ";"
-    << " previous rule was: " 
-    << boxpp(reverse(lhs1)) << " => " << boxpp(rhs1) << ";"
-    << endl;
-    
+      stringstream error;
+      
+    if (symbol==NULL) {
+        error 	<< "ERROR (file " << yyfilename << ":" << yylineno << ") : Inconsistent number of parameters in pattern-matching rule: "
+        << boxpp(reverse(lhs2)) << " => " << boxpp(rhs2) << ";"
+        << " previous rule was: "
+        << boxpp(reverse(lhs1)) << " => " << boxpp(rhs1) << ";"
+        << endl;
+    } else {
+        error 	<< "ERROR (file " << yyfilename << ":" << yylineno << ") : in the definition of " << boxpp(symbol) << "\n"
+        << "Inconsistent number of parameters in pattern-matching rule: "
+        << boxpp(reverse(lhs2)) << " => " << boxpp(rhs2) << ";"
+        << " previous rule was: "
+        << boxpp(reverse(lhs1)) << " => " << boxpp(rhs1) << ";"
+        << endl;
+    }
+
     return error.str();
 }
 
+
 Tree checkRulelist (Tree lr)
 {
 	Tree lrules = lr;
-	if (isNil(lrules)) { 
-        throw faustexception("ERROR : a case expression can't be empty\n");
-    }
+        if (isNil(lrules)) {
+          stringstream error;
+          error << "ERROR (file " << yyfilename << ":" << yylineno << ") : a case expression can't be empty" << endl;
+          throw faustexception(error.str());
+        }
+
 	// first pattern used as a reference
 	Tree lhs1 = hd(hd(lrules));
 	Tree rhs1 = tl(hd(lrules));
@@ -110,7 +124,7 @@
 		Tree lhs2 = hd(hd(lrules));
 		Tree rhs2 = tl(hd(lrules));
 		if (npat != len(lhs2)) {
-            throw faustexception(printPatternError(lhs1,rhs1,lhs2,rhs2));
+                  throw faustexception(printPatternError(NULL, lhs1,rhs1,lhs2,rhs2));
 		}
 		
 		lhs1 = lhs2;
@@ -120,13 +134,34 @@
 	return lr;
 }
 
+static string printRedefinitionError(Tree symbol, list<Tree>& variants)
+{
+    stringstream error;
+        
+    error 	<< "ERROR (file " << yyfilename << ":" << yylineno << ") : multiple definitions of symbol " << boxpp(symbol) << endl;
+    for (auto p=variants.begin(); p!=variants.end(); p++) {
+        Tree params = hd(*p);
+        Tree body = tl(*p);
+        
+        if (isNil(params)) {
+            error << boxpp(symbol) << " = " << boxpp(body) << ";" << endl;
+        } else {
+            error << boxpp(symbol) << boxpp(params) << " = " << boxpp(body) << ";" << endl;
+        }
+    }
+
+    return error.str();
+}
+
+
 /**
  * Transforms a list of variants (arglist.body) 
  * into an abstraction or a boxCase.
+ * @param symbol name only used in case of error
  * @param variants list of variants (arglist.body)
  * @return the corresponding box expression 
  */
-static Tree makeDefinition(list<Tree>& variants)
+static Tree makeDefinition(Tree symbol, list<Tree>& variants)
 {
 	if (variants.size() == 1) {
 		Tree rhs = *(variants.begin());
@@ -145,11 +180,15 @@
 		Tree	l = gGlobal->nil;
 		Tree	prev = *variants.begin();
 		int 	npat = len(hd(prev));
+        if (npat==0) {          
+          throw faustexception(printRedefinitionError(symbol, variants));
+        }
 		for (p=variants.begin(); p!=variants.end(); p++) {
 			Tree cur = *p;
-			if (npat != len(hd(cur))) {
-                throw faustexception(printPatternError(hd(prev), tl(prev), hd(cur), tl(cur)));
-			}
+                        if ((npat==0) || (npat != len(hd(cur)))) {
+                          throw faustexception(printPatternError(symbol, hd(prev), tl(prev), hd(cur), tl(cur)));
+                        }
+                        
 			prev = cur;
 			l = cons(*p,l);
 		}
