diff options
author | Ryo Nihei <nihei.dev@gmail.com> | 2021-07-30 23:41:24 +0900 |
---|---|---|
committer | Ryo Nihei <nihei.dev@gmail.com> | 2021-07-30 23:56:01 +0900 |
commit | a80538426fc6df3385e9567064d32b4b45a81669 (patch) | |
tree | c5049134d8e9011e0b7a0175fc4a64e52a7d5fd0 /grammar/semantic_error.go | |
parent | Add a token position and detailed info to a lexical error message (diff) | |
download | urubu-a80538426fc6df3385e9567064d32b4b45a81669.tar.gz urubu-a80538426fc6df3385e9567064d32b4b45a81669.tar.xz |
Detect unused-symbol error
When there are productions and terminals that are cannot be reached from the start symbol, the compiler reports an error.
Diffstat (limited to 'grammar/semantic_error.go')
-rw-r--r-- | grammar/semantic_error.go | 2 |
1 files changed, 2 insertions, 0 deletions
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") |