[fpc-pascal] More syntax questions (part 3)

Michael Van Canneyt michael at freepascal.org
Sat Dec 16 16:35:27 CET 2023



On Sat, 16 Dec 2023, Adriaan van Os via fpc-pascal wrote:

>
> More questions about the FreePascal Language Reference (version 3.2.0)  part 
> 3
>
> 26. Am I correct to assume the following equivalents for rules that I 
> couldn't find a definiton for:
>
> 	formal-parameter-list                  = parameter-declaration .
> 	parameter-list                         = parameter-declaration .
> 	hint-directives                        = { hint-directive } .
> 	hint-modifiers                         = call-modifiers .
> 	hintdirective                          = hint-directive .
> 	hintdirectives                         = hint-directives .
> 	integer                               := [ sign ] unsigned-integer .
> 	integer-constant                      := integer .
> 	integerconstant                       := integer-constant .
> 	typed-declaration                      = type-declaration .

Yes, although integer-constant, integerconstant and integer should simply all be
the same. I will correct that.

>
> 27. Section 13.2 defines a rule for <structured-statement> refering to a rule 
> <exception-statement>
>
> 	structured-statement = compound-statement | conditional-statement | 
> repetitive-statement | with-statement | exception-statement .
>
> Am I correct to assume ?
>
> 	exception-statement = try-except-statement | try-finally-statement .

Yes.

>
> where
>
> 	try-except-statement = "try" statement-list "except" 
> exceptionhandlers "END" .
> 	try-finally-statement = "try" statement-list "finally" 
> finally-statements "END" .

Yes.

>
> 28.  The documentation for macpas "UNIV" is missing ?

I have no idea what this is ?

>
> 29. Am I correct to assume ?
>
> 	ordinal-type = ordinal-type-identifier .
> 	ordinal-type-identifier = identifier .

Yes.

>
> 30. Am I correct to assume that <desctuctor-header> was meant to be 
> <destructor-header> ?

Yes.

>
> 31. Are the operators "<<" and ">>" missing  in the syntax diagrams ?

Yes and no.

I preferred not to document these since they are in fact C operators which I think
are a historical mistake.

>
> 32. Are the set operators "include", "exclude" missing in the syntax diagrams 
> ? Is "><" missing (specifically) as set operator in the syntax diagrams ?

Include/Exclude are not operators. They are procedure calls.

To illustrate, the following fails to compile:
---
type
   TEnum = (one,two,three);
   TEnums = set of TEnum;

var a : TEnums;

begin
   a:=[];
   a:=Include(a,one);
end.
---
iu.pp(9,6) Error: Incompatible types: got "untyped" expected "TEnums"
iu.pp(10,4) Fatal: There were 1 errors compiling module, stopping

The missing >< is an oversight

>
> 33. Section 12.1 gives "sign" in boldface in the rule for <factor>, 
> suggesting that it is a keyword. Is that correct ?

No.

It is not a keyword, but one of '+' or '-'.

Hm. Lot of corrections to do.. I'll be busy tonight :-)

Michael.


More information about the fpc-pascal mailing list