From d3991e161b1fc796e6232e682f0425cedbcd1af5 Mon Sep 17 00:00:00 2001 From: halw Date: Fri, 25 Sep 2009 20:05:52 +0000 Subject: [PATCH] Author:halw Date:2009-09-25T20:05:52.000000Z git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@307 abb3cda0-5349-4a8f-a601-0c33ac3a8c38 --- .../eiffel-programming-language-syntax.wiki | 511 ++++++++++++++++++ .../index.wiki | 11 + 2 files changed, 522 insertions(+) create mode 100644 documentation/current/method/quick-reference-eiffel-programming-language/eiffel-programming-language-syntax.wiki diff --git a/documentation/current/method/quick-reference-eiffel-programming-language/eiffel-programming-language-syntax.wiki b/documentation/current/method/quick-reference-eiffel-programming-language/eiffel-programming-language-syntax.wiki new file mode 100644 index 00000000..3e587296 --- /dev/null +++ b/documentation/current/method/quick-reference-eiffel-programming-language/eiffel-programming-language-syntax.wiki @@ -0,0 +1,511 @@ +[[Property:title|Eiffel syntax specification]] +[[Property:link_title|Eiffel programming language syntax]] +[[Property:weight|0]] +[[Property:uuid|d0f94270-f1e0-5545-2b1a-8cde3a6c73ab]] +{{underconstruction}} + + + + +The syntax specification is shown here as it is in the standard document. The format is BNF-E (Backus-Naur Form - Extended) which is also explained in the Language Specification section of the standard document. + + +==Eiffel Syntax== + +There are a few parts of the syntax that are either non-production or non-representable in BNF-E which have been omitted from the following specification. These omitted parts of the syntax definition add to the precision of the specification, but knowledge of them is not always vital for developers. + +Probably the most important to developers is the definition of an ''identifier'': + +===Identifiers=== + +An '''Identifier''' is a sequence of one or more alpha_numeric characters of which the first is a letter. + +The definition is augmented by the rule that Identifiers are not valid if they are the same as one of the language's reserved words. + + +===Class names === +Class_name =Δ [[#Identfiers|Identifier]]

+
+===Class declarations === +Class_declaration =Δ [[[#Notes|Notes]]]
+[[#Class headers|Class_header]]
+[[[#Formal generic parameters|Formal_generics]]]
+[[[#Obsolete marks|Obsolete]]]
+[[[#Inheritance parts|Inheritance]]]
+[[[#Creators parts|Creators]]]
+[[[#Converter clauses|Converters]]]
+[[[#Feature parts|Features]]]
+[[[#Assertions|Invariant]]]
+[[[#Notes|Notes]]]
+end
+
+===Notes === +Notes =Δ note Note_list
+Note_list =Δ {Note_entry ";" …}*
+Note_entry =Δ Note_name Note_values
+Note_name =Δ [[#Identifiers|Identifier]] ":"
+Note_values =Δ {Note_item ","…}+
+Note_item =Δ [[#Identifiers|Identifier]] | [[#Manifest constants|Manifest_constant]]
+
+===Class headers === +Class_header =Δ [Header_mark] class [[#Class names|Class_name]]
+Header_mark =Δ deferred | expanded | frozen
+
+===Obsolete marks === +Obsolete =Δ obsolete Message
+Message =Δ [[#Manifest strings|Manifest_string]]
+
+===Feature parts === +Features =Δ Feature_clause+
+Feature_clause =Δ feature [[[#Clients|Clients]]] [Header_comment] Feature_declaration_list
+Feature_declaration_list =Δ {[[#Feature declarations|Feature_declaration]] ";" …}*
+Header_comment =Δ Comment
+
+===Feature declarations === +Feature_declaration =Δ New_feature_list Declaration_body
+Declaration_body =Δ [Formal_arguments] [Query_mark] [Feature_value]
+Query_mark =Δ Type_mark [Assigner_mark]
+Type_mark =Δ ":" Type
+Feature_value =Δ [Explicit_value]
+[Obsolete]
+[Header_comment]
+[Attribute_or_routine]
+Explicit_value =Δ "=" Manifest_constant
+
+
+===New feature lists === +New_feature_list =Δ {New_feature "," …}+
+New_feature =Δ [frozen] Extended_feature_name
+
+
+===Feature bodies === +Attribute_or_routine =Δ [Precondition]
+[Local_declarations]
+Feature_body
+[Postcondition]
+[Rescue]
+end
+Feature_body =Δ Deferred | Effective_routine | Attribute
+
+
+===Feature names === +Extended_feature_name =Δ Feature_name [Alias]
+Feature_name =Δ Identifier
+Alias =Δ alias '"' Alias_name '"' [convert]
+Alias_name =Δ Operator | Bracket
+Bracket =Δ "[ ]"
+
+
+===Operators === +Operator =Δ Unary | Binary
+Unary =Δ not | "+" | "–" | Free_unary
+Binary =Δ "+" | "–" | "*" | "/" | "//" | "\\" | "^" | ".." |
+"<" | ">" | "<=" | ">=" |
+and | or | xor | and then | or else | implies |
+Free_binary
+
+
+===Assigner marks === +Assigner_mark =Δ assign Feature_name
+
+
+===Inheritance parts === +Inheritance =Δ Inherit_clause+
+Inherit_clause =Δ inherit [Non_conformance] Parent_list
+Non_conformance =Δ "{" NONE "}"
+Parent_list =Δ {Parent ";" …}+
+Parent =Δ Class_type [Feature_adaptation]
+Feature_adaptation =Δ [Undefine]
+[Redefine]
+[Rename]
+[New_exports]
+[Select]
+end
+
+
+
+===Rename clauses === +Rename =Δ rename Rename_list
+Rename_list =Δ {Rename_pair "," …}+
+Rename_pair =Δ Feature_name as Extended_feature_name
+
+
+===Clients === +Clients =Δ "{" Class_list "}"
+Class_list =Δ {Class_name "," …}+
+
+
+
+===Export adaptation === +New_exports =Δ export New_export_list
+New_export_list =Δ {New_export_item ";" …}+
+New_export_item =Δ Clients [Header_comment] Feature_set
+Feature_set =Δ Feature_list | all
+Feature_list =Δ {Feature_name "," …}+
+
+
+
+===Formal argument and entity declarations === +Formal_arguments =Δ "(" Entity_declaration_list ")"
+Entity_declaration_list =Δ {Entity_declaration_group ";" …}+
+Entity_declaration_group =Δ Identifier_list Type_mark
+Identifier_list =Δ {Identifier "," …}+
+
+
+===Routine bodies === +Deferred =Δ deferred
+Effective_routine =Δ Internal | External
+Internal =Δ Routine_mark Compound
+Routine_mark =Δ do | Once
+Once =Δ once [ "("Key_list ")" ]
+Key_list =Δ {Manifest_string "," …}+
+
+
+===Local variable declarations === +Local_declarations =Δ local [Entity_declaration_list]
+
+
+===Instructions === +Compound =Δ {Instruction ";" …}*
+Instruction =Δ Creation_instruction | Call | Assignment | Assigner_call | Conditional | Multi_branch
+| Loop | Debug | Precursor | Check | Retry
+
+
+===Assertions === +Precondition =Δ require [else] Assertion
+Postcondition =Δ ensure [then] Assertion [Only]
+Invariant =Δ invariant Assertion
+Assertion =Δ {Assertion_clause ";" …}*
+Assertion_clause =Δ [Tag_mark] Unlabeled_assertion_clause
+Unlabeled_assertion_clause =Δ Boolean_expression | Comment
+Tag_mark =Δ Tag ":"
+Tag =Δ Identifier
+
+
+===“Old” postcondition expressions === +Old =Δ old Expression
+
+
+===“Only” postcondition clauses === +Only =Δ only [Feature_list]
+
+
+===Check instructions === +Check =Δ check Assertion [Notes] end
+
+
+===Variants === +Variant =Δ variant [Tag_mark] Expression
+
+
+===Precursor === +Precursor =Δ Precursor [Parent_qualification] [Actuals]
+Parent_qualification =Δ "{" Class_name "}"
+
+
+===Redefinition === +Redefine =Δ redefine Feature_list
+
+
+===Undefine clauses === +Undefine =Δ undefine Feature_list
+
+
+===Types === +Type =Δ Class_or_tuple_type | Formal_generic_name | Anchored
+Class_or_tuple_type =Δ Class_type | Tuple_type
+Class_type =Δ [Attachment_mark] Class_name [Actual_generics]
+Attachment_mark =Δ "?" | "!"
+Anchored =Δ [Attachment_mark] like Anchor
+Anchor =Δ Feature_name | Current
+
+
+===Actual generic parameters === +Actual_generics =Δ "[" Type_list "]"
+Type_list =Δ {Type "," …}+
+
+
+===Formal generic parameters === +Formal_generics =Δ "[" Formal_generic_list "]"
+Formal_generic_list =Δ {Formal_generic ","…}+
+Formal_generic =Δ [frozen] Formal_generic_name [Constraint]
+Formal_generic_name =Δ [?] Identifier
+
+
+===Generic constraints === +Constraint =Δ "–>" Constraining_types [Constraint_creators]
+Constraining_types =Δ Single_constraint | Multiple_constraint
+Single_constraint =Δ Type [Renaming]
+Renaming =Δ Rename end
+Multiple_constraint =Δ "{" Constraint_list "}"
+Constraint_list =Δ {Single_constraint "," …}+
+Constraint_creators =Δ create Feature_list end
+
+
+===Tuple types === +Tuple_type =Δ TUPLE [Tuple_parameter_list]
+Tuple_parameter_list =Δ "[" Tuple_parameters "]"
+Tuple_parameters =Δ Type_list | Entity_declaration_list
+
+
+===Manifest tuples === +Manifest_tuple =Δ "[" Expression_list "]"
+Expression_list =Δ {Expression "," …}*
+
+
+===Converter clauses === +Converters =Δ convert Converter_list
+Converter_list =Δ {Converter ","…}+
+Converter =Δ Conversion_procedure | Conversion_query
+Conversion_procedure =Δ Feature_name "(" "{" Type_list "}" ")"
+Conversion_query =Δ Feature_name ":" "{" Type_list "}"
+
+
+===Select clauses === +Select =Δ select Feature_list
+
+
+===Conditionals === +Conditional =Δ if Then_part_list [Else_part] end
+Then_part_list =Δ {Then_part elseif …}+
+Then_part =Δ Boolean_expression then Compound
+Else_part =Δ else Compound
+
+
+===Multi-branch instructions === +Multi_branch =Δ inspect Expression [When_part_list] [Else_part] end
+When_part_list =Δ When_part+
+When_part =Δ when Choices then Compound
+Choices =Δ {Choice "," …}+
+Choice =Δ Constant | Manifest_type | Constant_interval | Type_interval
+Constant_interval =Δ Constant ".." Constant
+Type_interval =Δ Manifest_type ".." Manifest_type
+
+
+===Loops === +Loop =Δ Initialization
+[Invariant]
+Exit_condition
+Loop_body
+[Variant]
+end
+Initialization =Δ from Compound
+Exit_condition =Δ until Boolean_expression
+Loop_body =Δ loop Compound
+
+
+===Debug instructions === +Debug =Δ debug [ "("Key_list ")" ] Compound end
+
+
+===Attribute bodies === +Attribute =Δ attribute Compound
+
+
+===Entities and variables === +Entity =Δ Variable | Read_only
+Variable =Δ Variable_attribute | Local
+Variable_attribute =Δ Feature_name
+Local =Δ Identifier | Result
+Read_only =Δ Formal | Constant_attribute | Current
+Formal =Δ Identifier
+Constant_attribute =Δ Feature_name
+
+
+===Creators parts === +Creators =Δ Creation_clause+
+Creation_clause =Δ create [Clients] [Header_comment] Creation_procedure_list
+Creation_procedure_list =Δ {Creation_procedure ","…}+
+Creation_procedure =Δ Feature_name
+
+
+===Creation instructions === +Creation_instruction =Δ create [Explicit_creation_type] Creation_call
+Explicit_creation_type =Δ "{" Type "}"
+Creation_call =Δ Variable [Explicit_creation_call]
+Explicit_creation_call =Δ "." Unqualified_call
+
+
+===Creation expressions === +Creation_expression =Δ create Explicit_creation_type [Explicit_creation_call]
+
+
+===Equality expressions === +Equality =Δ Expression Comparison Expression
+Comparison =Δ "=" | "/=" | "~" | "/~"
+
+
+===Assignments === +Assignment =Δ Variable ":=" Expression
+
+
+===Assigner calls === +Assigner_call =Δ Expression ":=" Expression
+
+
+===Feature calls === +Call =Δ Object_call | Non_object_call
+Object_call =Δ [Target "."] Unqualified_call
+Unqualified_call =Δ Feature_name [Actuals]
+Target =Δ Local | Read_only | Call | Parenthesized_target
+Parenthesized_target =Δ "( |" Expression "| )"
+Non_object_call =Δ "{" Type "}" "." Unqualified_call
+
+
+===Actual arguments === +Actuals =Δ "(" Actual_list ")"
+Actual_list =Δ {Expression "," …}+
+
+
+===Object test === +Object_test =Δ "{" Identifier ":" Type "}" Expression
+
+
+===Rescue clauses === +Rescue =Δ rescue Compound
+Retry =Δ retry
+
+
+===Agents === +Agent =Δ Call_agent | Inline_agent
+Call_agent =Δ agent Call_agent_body
+Inline_agent =Δ agent [Formal_arguments] [Type_mark] [Attribute_or_routine] [Agent_actuals]
+
+
+===Call agent bodies === +Call_agent_body =Δ Agent_qualified | Agent_unqualified
+Agent_qualified =Δ Agent_target ". " Agent_unqualified
+Agent_unqualified =Δ Feature_name [Agent_actuals]
+Agent_target =Δ Entity | Parenthesized | Manifest_type
+Agent_actuals =Δ "(" Agent_actual_list ")"
+Agent_actual_list =Δ {Agent_actual "," …}+
+Agent_actual =Δ Expression | Placeholder
+Placeholder =Δ [Manifest_type] "?"
+
+
+===Expressions === +Expression =Δ Basic_expression | Special_expression
+Basic_expression =Δ Read_only | Local | Call | Precursor | Equality | Parenthesized | Old |
+Operator_expression | Bracket_expression | Creation_expression
+Special_expression =Δ Manifest_constant | Manifest_tuple | Agent | Object_test | Once_string |
+Address
+Parenthesized =Δ "(" Expression ")"
+Address =Δ "$" Variable
+Once_string =Δ once Manifest_string
+Boolean_expression =Δ Basic_expression | Boolean_constant | Object_test
+
+
+===Operator expressions === +Operator_expression =Δ Unary_expression | Binary_expression
+Unary_expression =Δ Unary Expression
+Binary_expression =Δ Expression Binary Expression
+
+
+===Bracket expressions === +Bracket_expression =Δ Bracket_target "[" Actuals "]"
+Bracket_target =Δ Target | Once_string | Manifest_constant | Manifest_tuple
+
+
+===Constants === +Constant =Δ Manifest_constant | Constant_attribute
+Constant_attribute =Δ Feature_name
+
+
+===Manifest constants === +Manifest_constant =Δ [Manifest_type] Manifest_value
+Manifest_type =Δ "{" Type "}"
+Manifest_value =Δ Boolean_constant |
+Character_constant |
+Integer_constant |
+Real_constant |
+Manifest_string |
+Manifest_type
+Sign =Δ "+" | "–"
+Integer_constant =Δ [Sign] Integer
+Character_constant =Δ " ' " Character " ' "
+Boolean_constant =Δ True | False
+Real_constant =Δ [Sign] Real
+
+
+===Manifest strings === +Manifest_string =Δ Basic_manifest_string | Verbatim_string
+Basic_manifest_string =Δ ' " ' String_content ' " '
+String_content =Δ {Simple_string Line_wrapping_part …}+
+Verbatim_string =Δ Verbatim_string_opener Line_sequence Verbatim_string_closer
+Verbatim_string_opener =Δ ' " ' [Simple_string] Open_bracket
+Verbatim_string_closer =Δ Close_bracket [Simple_string] ' " '
+Open_bracket =Δ "[" | "{"
+Close_bracket =Δ "]" | "}"Verbatim_string =Δ Verbatim_string_opener Line_sequence Verbatim_string_closer
+Verbatim_string_opener =Δ ' " ' [Simple_string] Open_bracket
+Verbatim_string_closer =Δ Close_bracket [Simple_string] ' " '
+Open_bracket =Δ "[" | "{"
+Close_bracket =Δ "]" | "}"
+
+
+===External routines === +External =Δ external External_language [External_name]
+External_language =Δ Unregistered_language | Registered_language
+Unregistered_language =Δ Manifest_string
+External_name =Δ alias Manifest_string
+
+
+===Registered languages === +Registered_language =Δ C_external | C++_external | DLL_external
+
+
+===External signatures === +External_signature =Δ signature [External_argument_types] [: External_type]
+External_argument_types =Δ "(" External_type_list ")"
+External_type_list =Δ {External_type "," …}*
+External_type =Δ Simple_string
+
+
+===External file use === +External_file_use =Δ use External_file_list
+External_file_list =Δ {External_file "," …}+
+External_file =Δ External_user_file | External_system_file
+External_user_file =Δ ' " ' Simple_string ' " '
+External_system_file =Δ "<"Simple_string ">"
+
+
+===C externals === +C_external =Δ ’' " ' C
+’[inline]
+[External_signature] [External_file_use]
+' " '
+
+
+===C++ externals === +C++_external =Δ ' " ' C++
+inline
+[External_signature]
+[External_file_use]
+' " '
+
+
+===DLL externals === +DLL_external =Δ ' " ' dll
+[windows]
+DLL_identifier
+[DLL_index]
+[External_signature]
+[External_file_use]
+' " '
+DLL_identifier =Δ Simple_string
+DLL_index =Δ Integer
+
+
+===Comments === +Comment =Δ "– –" {Simple_string Comment_break …}*
+Comment_break =Δ New_line [Blanks_or_tabs] "– –"
+
+===Integers === +Integer =Δ [Integer_base] Digit_sequence
+Integer_base =Δ "0" Integer_base_letter
+Integer_base_letter =Δ "b" | "c" | "x" | "B" | "C" | "X"
+Digit_sequence =Δ Digit+
+Digit =Δ "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" |
+"a" | "b" | "c" | "d" | "e" | "f" |
+"A" | "B" | "C" | "D" | "E" | "F" | "_"
+ + diff --git a/documentation/current/method/quick-reference-eiffel-programming-language/index.wiki b/documentation/current/method/quick-reference-eiffel-programming-language/index.wiki index 7832076f..4545a2b0 100644 --- a/documentation/current/method/quick-reference-eiffel-programming-language/index.wiki +++ b/documentation/current/method/quick-reference-eiffel-programming-language/index.wiki @@ -6,3 +6,14 @@ +Eiffel the Language is described in detail in the ISO/ECMA standard document, available [http://www.ecma-international.org/publications/standards/Ecma-367.htm online]. + +Sometimes there are differences between the language as defined by the standard and that which is implemented by Eiffel Software. These differences are documented in a [[Differences between standard ECMA-367 and Eiffel Software implementation|chapter]] of the online documentation. + +So, the final authority on Eiffel as implemented by Eiffel Software is the content of the standard document, amended by those variances cited in the "differences" [[Differences between standard ECMA-367 and Eiffel Software implementation|chapter]] of the online documentation. + +The Quick Reference to Eiffel here to provide an informal guide to the language. Because this reference is based on the 2006 ISO/ECMA standard document, you should be aware that some differences may exist between what is in the Quick Reference and the implementation. + + + +