Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2005-05

FPC Syntax

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Hans-Peter Diettrich

A friend has found some obvious errors in the FPC syntax description, and I found some more errors. Here is our current list:

==== ================================================================== page Expected Error Description
==== ================================================================== p010:
in
characters: ";" is missing
character pair ".." is missing
======================================================================== p022:
Where is delphi real type Currency
======================================================================== p041
Normally a list of variables may be declared:
------------------------------------------------------------------------ variable_declaration =
list ":"
type [ ("=" typed_constant) | variable modifiers ] ";" . --- should read ---
variable_declaration =
identifier_list ":"
type [ ("=" typed_constant) | variable modifiers ] ";" . identifier_list =
identifier { "," identifier} .
DoDi:
Should read like [ "=" typed_constant ] | [ variable_modifiers ]? Should distinguish single variables, with possible modifiers, from variable list, with no(?) modifiers allowed?
======================================================================== p044:
the word "property" is missing
where is "stored" property
======================================================================== p048:
"object_type" is missing in 1st description
======================================================================== p055
class_reference_type
"class_type" is missing
======================================================================== p072
addressfactor
should read
address_factor
======================================================================== P069
expression : "*" should read "<" .
======================================================================== p087
formal parameter list
may by empty
======================================================================== p101
parameter_list
should read
formal_parameter_list
======================================================================== p108
where is VAR variable_declaration_part
======================================================================== p112
where is "resident" in exports clause
======================================================================== p113
where is "raise" in raise_statement
======================================================================== Sometimes:
integerconstant: p044, p059
integer_constant: p095, p112
Missing:
array_constant
constant
default_parameter_value
exception_instance
exception_statement
integer_constant
method_designator
procedural_constant
qualified_method_designator
record_constant
Assumed:
address_expression = expression .
address_constant = expression .
class_type_identifier = identifier .
constant_identifier = identifier .
function_identifier = identifier .
field_identifier = identifier .
interface_type_identifier = identifier .
integer_expression = expression .
method_identifier = identifier .
object_type_identifier = identifier .
octal_digit = "0".."7" .
parameter_type = identifier .
procedure_identifier = identifier .
qualified_method_identifier = identifier { "." identifier } . result_identifier = identifier .
string_constant = character_string .
string_constant_declaration = identifier "=" character_string . type_identifier = identifier .
unit_identifier = identifier .
variable = identifier .
variable_identifier = identifier .
variable_reference = identifier .

DoDi:

p013
"^"<letter> is missing as escaped character.

p015
All <address constant> etc. should be described.
(See above)

p017
What about type: <identifier> "=" "type" <typedef>? (Delphi mode only?)

p020
	In enum types both "=" and ":=" are accepted.
(IMO ":=" could be removed here)

p079
According to the examples the semicolon is a case
delimiter/terminator, not a separator.
The <else part> contains a <statement sequence>.
(The optional semicolon before "end" should be moved before "else").

The syntax of the Case statement has been seriously damaged by the introduction of the Else part, this is a problem not only in the FPC grammar. IMO the syntax diagram should be corrected, somehow, and the quirks should be addressed in the comments.

p080:
What does this mean:
"The case statements can be compound statements (i.e. a begin..End block)."
Do there exist cases where a compound statement can *not* replace a statement?

About case and variant records:
Why is the syntax for Case labels different in Case statement and Record types?
In the variant part of an record no ranges a..b are allowed. This IMO is not a meaningful restriction, which requires different descriptions and different handling in the compiler.

Should we continue to search for more errors?

DoDi

Reply by email

Michael Van Canneyt
to Hans-Peter Diettrich
Hans-Peter Diettrich wrote 152 lines
A friend has found some obvious errors in the FPC syntax description, and I found some more errors. Here is our current list: ==== ================================================================== page Expected Error Description ==== ================================================================== p010: in characters: ";" is missing character pair ".." is missing ======================================================================== p022: Where is delphi real type Currency ======================================================================== p041 Normally a list of variables may be declared: ------------------------------------------------------------------------ variable_declaration = list ":" type [ ("=" typed_constant) | variable modifiers ] ";" . --- should read --- variable_declaration = identifier_list ":" type [ ("=" typed_constant) | variable modifiers ] ";" . identifier_list = identifier { "," identifier} . DoDi: Should read like [ "=" typed_constant ] | [ variable_modifiers ]? Should distinguish single variables, with possible modifiers, from variable list, with no(?) modifiers allowed? ======================================================================== p044: the word "property" is missing where is "stored" property ======================================================================== p048: "object_type" is missing in 1st description ======================================================================== p055 class_reference_type "class_type" is missing ======================================================================== p072 addressfactor should read address_factor ======================================================================== P069 expression : "*" should read "<" . ======================================================================== p087 formal parameter list may by empty ======================================================================== p101 parameter_list should read formal_parameter_list ======================================================================== p108 where is VAR variable_declaration_part ======================================================================== p112 where is "resident" in exports clause ======================================================================== p113 where is "raise" in raise_statement ======================================================================== Sometimes: integerconstant: p044, p059 integer_constant: p095, p112 Missing: array_constant constant default_parameter_value exception_instance exception_statement integer_constant method_designator procedural_constant qualified_method_designator record_constant Assumed: address_expression = expression . address_constant = expression . class_type_identifier = identifier . constant_identifier = identifier . function_identifier = identifier . field_identifier = identifier . interface_type_identifier = identifier . integer_expression = expression . method_identifier = identifier . object_type_identifier = identifier . octal_digit = "0".."7" . parameter_type = identifier . procedure_identifier = identifier . qualified_method_identifier = identifier { "." identifier } . result_identifier = identifier . string_constant = character_string . string_constant_declaration = identifier "=" character_string . type_identifier = identifier . unit_identifier = identifier . variable = identifier . variable_identifier = identifier . variable_reference = identifier . DoDi: p013 "^"<letter> is missing as escaped character. p015 All <address constant> etc. should be described. (See above) p017 What about type: <identifier> "=" "type" <typedef>? (Delphi mode only?) p020 In enum types both "=" and ":=" are accepted. (IMO ":=" could be removed here) p079 According to the examples the semicolon is a case delimiter/terminator, not a separator. The <else part> contains a <statement sequence>. (The optional semicolon before "end" should be moved before "else"). The syntax of the Case statement has been seriously damaged by the introduction of the Else part, this is a problem not only in the FPC grammar. IMO the syntax diagram should be corrected, somehow, and the quirks should be addressed in the comments. p080: What does this mean: "The case statements can be compound statements (i.e. a begin..End block)." Do there exist cases where a compound statement can *not* replace a statement? About case and variant records: Why is the syntax for Case labels different in Case statement and Record types? In the variant part of an record no ranges a..b are allowed. This IMO is not a meaningful restriction, which requires different descriptions and different handling in the compiler. Should we continue to search for more errors?

Yes, please. All corrections to the documentation are welcome.

But when reporting errors, don't use page numbers, page numbers vary;
use section/subsection/paragraph numbering.

Michael.

Reply by email