[fpc-pascal] inherited

Adriaan van Os adriaan at adriaan.biz
Thu Dec 21 09:11:05 CET 2023


Sections 5.5.2 and 6.6.8 of the FreePascal Language Reference discuss the "inherited" keyword, but 
I couldn't find it in the syntax diagrams. Sections 12.2 and 13.1.2. have

	procedure-statement = ( procedure-identifier | method-identifier | qualified-method-identifier | 
variable-reference ) [ actual-parameter-list ] .
	function-call = ( function-identifier | method-designator | qualified-method-designator | 
variable-reference ) [ actual-parameter-list ] .

This can be changed to

	procedure-reference = qualified-identifier | procedure-identifier | variable-reference .
	function-reference = qualified-identifier | function-identifier | variable-reference .
	procedure-statement = ( "inherited" [ procedure-reference ] | procedure-reference ) [ 
actual-parameter-list ] .
	function-call = ( "inherited" [ function-reference ] | function-reference ) [ 
actual-parameter-list ] .

That adds the "inherited" keyword, but doesn't include, for example, identifier-casts. The problem 
with identifier casts is that, grammatically, a cast can not be distinguished from a function call. 
Therefore, the cast has to be treated, in the grammar, as a (one-parameter) function call.

So, things are more complex that indicated above. A solution may be along the line of what 
UCSD-Pascal defines ....

	selector = "[" expression { "," expression } "]" | "." identifier | "^" .
	variable = identifier { selector } .

Regards,

Adriaan van Os



More information about the fpc-pascal mailing list