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

Adriaan van Os adriaan at adriaan.biz
Sun Dec 17 13:46:09 CET 2023


Michael Van Canneyt via fpc-pascal wrote:
> 
> 
> On Sat, 16 Dec 2023, Adriaan van Os via fpc-pascal wrote:
> 
>>
>> More questions about the FreePascal Language Reference (version 
>> 3.2.0)  part 2
>>
>> 17. For the following rules, I couldn't find a definition in the 
>> Language Reference. Can I assume they can all be defined as 
>> <identifier> ?
>>
>>     object-type-identifier                 = identifier .
>>     field-identifier                       = identifier .
>>     interface-identifier                   = identifier .
>>     interface-type-identifier              = identifier .
>>     method-identifier                      = identifier .
>>     procedure-identifier                   = identifier .
>>     protocol-identifier                    = identifier .
>>     protocol-type-identifier               = identifier .
>>     qualified-method-identifier            = identifier .
>>     result-identifier                      = identifier .
>>     type-identifier                        = identifier .
>>     function-identifier                    = identifier .
>>     unit-identifier                        = identifier .
>>     variable-identifier                    = identifier .
> 
> Yes.
> 
> The idea was to use these "dedicated names" to convey that the 
> identifier must be of a certain type.
> 
> You cannot express this concept in a formal syntax, but for a formal 
> syntax the above is correct.

Of course, a rule like

	proc-identifier = procedure-identifier | function-identifier .

makes no sense without the semantics of a symbol table (to decide between the two), but rules like

	procedure-heading = "PROCEDURE" procedure-identifier ....
	function-heading = "FUNCTION" function-identifier ....
	procedure-identifier = identifier .
	function-identifier = identifier .

do make sense, even without semantics, because in the parsing(-only) tree, a procedure-identifier 
(etc.) node is now marked as such, and not just as identifier. In certain applications of a 
parsing(-only) tree this is quite useful.

Regards,

Adriaan van Os



More information about the fpc-pascal mailing list