Semantic-analysis diagnostics use the E3000-E3999 range.
nes.runnes.run
statement.Trigger:
begin
nes.set_background_color($21);
end.
Expected compiler output:
E3001 demo.nsp:4:1
The program must end with nes.run.
nes.run; as the final statement.nes.runnes.run transfers control to the stable main loop, so no
later statement can execute.Trigger:
nes.run;
Counter := $01;
Expected compiler output:
E3002 demo.nsp:2:1
No statement may appear after nes.run.
nes.run; to the end of the block.nes.set_background_color.Trigger:
begin
nes.run;
end.
Expected compiler output:
E3003 demo.nsp:3:1
The program must set the background color exactly once.
nes.set_background_color(value); call before
nes.run.Trigger:
var
Color: byte;
COLOR: byte;
Expected compiler output:
E3004 demo.nsp:3:5
Symbol COLOR is already declared.
Trigger:
Counter := Missing;
Expected compiler output:
E3005 demo.nsp:1:12
Unknown identifier: Missing.
Trigger:
Maximum := $10;
Expected compiler output:
E3006 demo.nsp:1:1
Cannot assign to constant Maximum.
Trigger:
Missing := $01;
Expected compiler output:
E3007 demo.nsp:1:1
Unknown variable: Missing.
var section.Trigger:
var
BackgroundColor: nes_color;
begin
nes.set_background_color(BackgroundColor);
Expected compiler output:
E3008 demo.nsp:4:30
Variable BackgroundColor is read before it is assigned.
nes.set_background_color(BackgroundColor);
^^^^^^^^^^^^^^^
nes.set_background_color and nes.run cannot
be placed on a conditional execution path.Trigger:
if Enabled then
nes.run;
Expected compiler output:
E3009 demo.nsp:2:5
nes.run cannot appear inside a conditional branch.
break and continue require an enclosing while,
repeat, or for loop that provides their control-flow target.Trigger:
begin
break;
end.
Expected compiler output:
E3010 demo.nsp:2:5
break can appear only inside a loop.
nes.set_background_color and nes.run cannot be repeated by a loop.Trigger:
while Running do
nes.run;
Expected compiler output:
E3011 demo.nsp:2:5
nes.run cannot appear inside a loop body.
for loop owns its control variable while its body is
executing. Assigning it, updating it with inc or dec, or reusing it as
the control variable of a nested for would make loop termination
unpredictable.Trigger:
for Index := $00 to $03 do
Index := $01;
Expected compiler output:
E3012 demo.nsp:2:5
For control variable Index cannot be modified inside its loop body.
Trigger:
begin
Missing;
end.
Expected compiler output:
E3013 demo.nsp:2:5
Unknown procedure: Missing.
Trigger:
procedure Again;
begin
Again;
end;
Expected compiler output:
E3014 demo.nsp:4:5
Recursive procedure call involving Again is not supported.
nes.set_background_color and nes.run belong to the main
initialization sequence and must execute exactly once. They cannot be hidden
behind a procedure call.Trigger:
procedure StartRuntime;
begin
nes.run;
end;
Expected compiler output:
E3015 demo.nsp:4:5
nes.run cannot appear inside a procedure.
Trigger:
procedure Initialize(Value: byte);
begin
end;
begin
Initialize;
end.
Expected compiler output:
E3016 demo.nsp:7:5
Procedure Initialize expects 1 argument(s), but 0 were provided.