From a80538426fc6df3385e9567064d32b4b45a81669 Mon Sep 17 00:00:00 2001 From: Ryo Nihei Date: Fri, 30 Jul 2021 23:41:24 +0900 Subject: Detect unused-symbol error When there are productions and terminals that are cannot be reached from the start symbol, the compiler reports an error. --- grammar/semantic_error.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'grammar/semantic_error.go') diff --git a/grammar/semantic_error.go b/grammar/semantic_error.go index ca84cf0..9006124 100644 --- a/grammar/semantic_error.go +++ b/grammar/semantic_error.go @@ -15,6 +15,8 @@ func (e *SemanticError) Error() string { } var ( + semErrUnusedProduction = newSemanticError("unused production") + semErrUnusedTerminal = newSemanticError("unused terminal") semErrNoProduction = newSemanticError("a grammar needs at least one production") semErrUndefinedSym = newSemanticError("undefined symbol") semErrDuplicateProduction = newSemanticError("duplicate production") -- cgit v1.2.3