Skip to main content

UndeclaredNonTerminal

rascal-0.34.0

Synopsis

A syntax rule uses an undeclared non-terminal.

Description

All non-terminals that occur in a syntax definition should be declared in some rule. This error is generated when this is not the case.

Remedy: declare the offending non-terminal.

Examples

Here is an example where the non-terminal Y is not declared:

rascal>import ParseTree;
ok
rascal>syntax X = "a" Y;
ok
rascal>parse(#X, "ab");
|lib://rascal/org/rascalmpl/library/ParseTree.rsc|(15675,7,<396,88>,<396,95>): Undeclared non-terminal: Y in module $GENERATED_PARSER$37351774
Advice: |https://www.rascal-mpl.org/docs/Rascal/Errors/CompileTimeErrors/UndeclaredNonTerminal|
ok

Pitfalls

The source location of the non-terminal is not yet available, so the error message mentions the module in which this occurs.