foo.cc:1:1: error: 'program' does not name a type
program hello;
^~~~~~~
foo.cc:2:1: error: 'var' does not name a type; did you mean 'char'?
var
^~~
char
foo.cc:4:3: error: found ':' in nested-name-specifier, expected '::'
X: array [0 .. 20] of integer;
^
foo.cc:4:2: error: 'X' does not name a type
X: array [0 .. 20] of integer;
^
foo.cc:5:3: error: found ':' in nested-name-specifier, expected '::'
i: integer;
^
foo.cc:5:2: error: 'i' does not name a type
i: integer;
^
foo.cc:6:3: error: found ':' in nested-name-specifier, expected '::'
n: integer;
^
foo.cc:6:2: error: 'n' does not name a type
n: integer;
^
foo.cc:8:1: error: 'function' does not name a type; did you mean 'union'?
function F(n: integer): integer;
^~~~~~~~
union
foo.cc:9:1: error: 'var' does not name a type; did you mean 'char'?
var
^~~
char
foo.cc:11:1: error: 'begin' does not name a type
begin
^~~~~
foo.cc:15:2: error: 'end' does not name a type; did you mean 'enum'?
end;
^~~
enum
foo.cc:16:2: error: expected unqualified-id before 'else'
else begin
^~~~
foo.cc:18:3: error: expected unqualified-id before 'for'
for i := 1 to 5 do
^~~
foo.cc:21:3: error: 'end' does not name a type; did you mean 'enum'?
end;
^~~
enum
foo.cc:22:2: error: 'end' does not name a type; did you mean 'enum'?
end;
^~~
enum
foo.cc:23:2: error: 'X' does not name a type
X[n] := F;
^
foo.cc:24:1: error: 'end' does not name a type; did you mean 'enum'?
end;
^~~
enum
foo.cc:26:1: error: 'begin' does not name a type
begin
^~~~~
foo.cc:30:2: error: 'end' does not name a type; did you mean 'enum'?
end;
^~~
enum
foo.cc:31:6: error: expected constructor, destructor, or type conversion before '(' token
read(n);
^
foo.cc:32:9: error: expected constructor, destructor, or type conversion before '(' token
writeln(F(n));
^
foo.cc:33:1: error: 'end' does not name a type; did you mean 'enum'?
end.
^~~
enum
自豪的采用 HydroJudger 进行评测(github.com/hydro-dev/HydroJudger)