diff --git a/standard/README.md b/standard/README.md index 62b3f711b..93e272845 100644 --- a/standard/README.md +++ b/standard/README.md @@ -48,7 +48,7 @@ - [§6.5.9](lexical-structure.md#659-nullable-directive) Nullable directive - [§6.5.10](lexical-structure.md#6510-pragma-directives) Pragma directives - [§7](basic-concepts.md#7-basic-concepts) Basic concepts - - [§7.1](basic-concepts.md#71-application-startup) Application startup + - [§7.1](basic-concepts.md#71-application-startup-and-termination) Application startup - [§7.2](basic-concepts.md#72-application-termination) Application termination - [§7.3](basic-concepts.md#73-declarations) Declarations - [§7.4](basic-concepts.md#74-members) Members diff --git a/standard/attributes.md b/standard/attributes.md index 1ba8b51a3..7e6b80d80 100644 --- a/standard/attributes.md +++ b/standard/attributes.md @@ -833,6 +833,8 @@ The attribute `System.Runtime.CompilerServices.CallerMemberNameAttribute` is all If a function invocation from a location within the body of a function member or within an attribute applied to the function member itself or its return type, parameters or type parameters in source code omits an optional parameter with the `CallerMemberNameAttribute`, then a string literal representing the name of that member is used as an argument to the invocation instead of the default parameter value. +> *Note*: In the case of a function invocation from a top-level statement the string is a representation of the implementation provided name (§using-top-level-statements). *end note* + For invocations that occur within generic methods, only the method name itself is used, without the type parameter list. For invocations that occur within explicit interface member implementations, only the method name itself is used, without the preceding interface qualification. diff --git a/standard/basic-concepts.md b/standard/basic-concepts.md index 499c701e7..42c828900 100644 --- a/standard/basic-concepts.md +++ b/standard/basic-concepts.md @@ -1,59 +1,134 @@ # 7 Basic concepts -## 7.1 Application startup +## 7.1 Application startup and termination + +### §app-startup-general General A program may be compiled either as a ***class library*** to be used as part of other applications, or as an ***application*** that may be started directly. The mechanism for determining this mode of compilation is implementation-defined and external to this specification. -A program compiled as an application shall contain at least one method qualifying as an entry point by satisfying the following requirements: +When an application is run, a new ***application domain*** is created. Several different instantiations of an application may exist on the same machine at the same time, and each has its own application domain. +An application domain enables application isolation by acting as a container for application state. An application domain acts as a container and boundary for the types defined in the application and the class libraries it uses. Types loaded into one application domain are distinct from the same types loaded into another application domain, and instances of objects are not directly shared between application domains. For instance, each application domain has its own copy of static variables for these types, and a static constructor for a type is run at most once per application domain. Implementations are free to provide implementation-defined policy or mechanisms for the creation and destruction of application domains. + +An application run is initiated by invoking an ***entry point*** which is selected at compile-time from candidate entry points which are specified in any of the following ways: + +1. Explicitly, by declaring a method with appropriate characteristics (§named-entry-points). +1. Implicitly, by using top-level statements (§using-top-level-statements). +1. Implementation-defined, by using a mechanism external to this specification to designate the entry point (§externally-defined-entry-point). + +> *Note*: With the exception of top-level statement candidates (§using-top-level-statements) all candidate entry points are standard methods; being a candidate, or the selected entry point, does not prevent these methods being invoked as normal. *end note* + +It is a compile-time error if there are no candidate entry points. + +Otherwise one candidate is selected at compile-time as the entry point following the process in §entry-point-selection. + +An application is run by invoking the selected entry point as described in §entry-point-invocation. + +The ***termination status code***, the purpose of which is to allow communication of success or failure to the host environment, is determined based on the result from the entry point invocation (§entry-point-invocation). + +### §named-entry-points Named entry points + +A method qualifies as a canditate entry point by satisfying the following requirements: - It shall have the name `Main`. - It shall be `static`. - It shall not be generic. - It shall be declared in a non-generic type. If the type declaring the method is a nested type, none of its enclosing types may be generic. -- It may have the `async` modifier provided the method’s return type is `System.Threading.Tasks.Task` or `System.Threading.Tasks.Task`. - The return type shall be `void`, `int`, `System.Threading.Tasks.Task`, or `System.Threading.Tasks.Task`. +- It may have the `async` modifier only if the method’s return type is `System.Threading.Tasks.Task` or `System.Threading.Tasks.Task`. - It shall not be a partial method ([§15.6.9](classes.md#1569-partial-methods)) without an implementation. - The parameter list shall either be empty, or have a single value parameter of type `string[]`. -> *Note*: Methods with the `async` modifier must have exactly one of the two return types specified above in order to qualify as an entry point. An `async void` method, or an `async` method returning a different awaitable type such as `ValueTask` or `ValueTask` does not qualify as an entry point. *end note* +The declared accessibility ([§7.5.2](basic-concepts.md#752-declared-accessibility)) of a method is ignored for the purposes of qualifying as a candidate entry point. At application startup the selected entry point is invoked regardless of its declared accessibility. However any declared accessibility continues to apply if the selected candidate entry point is invoked after application startup. -If more than one method qualifying as an entry point is declared within a program, an external mechanism may be used to specify which method is deemed to be the actual entry point for the application. If a qualifying method having a return type of `int` or `void` is found, any qualifying method having a return type of `System.Threading.Tasks.Task` or `System.Threading.Tasks.Task` is not considered an entry point method. It is a compile-time error for a program to be compiled as an application without exactly one entry point. A program compiled as a class library may contain methods that would qualify as application entry points, but the resulting library has no entry point. +> *Note*: The requirements here do not specify that `Main` should be a class member, it can be a struct member. *end note* -Ordinarily, the declared accessibility ([§7.5.2](basic-concepts.md#752-declared-accessibility)) of a method is determined by the access modifiers ([§15.3.6](classes.md#1536-access-modifiers)) specified in its declaration, and similarly the declared accessibility of a type is determined by the access modifiers specified in its declaration. In order for a given method of a given type to be callable, both the type and the member shall be accessible. However, the application entry point is a special case. Specifically, the execution environment can access the application’s entry point regardless of its declared accessibility and regardless of the declared accessibility of its enclosing type declarations. +### §using-top-level-statements Using top-level statements -When the entry point method has a return type of `System.Threading.Tasks.Task` or `System.Threading.Tasks.Task`, a compiler shall synthesize a synchronous entry-point method that calls the corresponding `Main` method. The synthesized method has parameters and return types based on the `Main` method: +A single compilation unit ([§14.2](namespaces.md#142-compilation-units) in an application may contain a *statement_list*; called the ***top-level statements***. The meaning of the top-level statements is semantically equivalent to declaring the following in the global namespace: -- The parameter list of the synthesized method is the same as the parameter list of the `Main` method -- If the return type of the `Main` method is `System.Threading.Tasks.Task`, the return type of the synthesized method is `void` -- If the return type of the `Main` method is `System.Threading.Tasks.Task`, the return type of the synthesized method is `int` +```csharp +partial class Program +{ + static «AsyncAndReturnType» «Main»(string[] args) + { + «statement_list» + } +} +``` -Execution of the synthesized method proceeds as follows: +The class `Program` is a partial type declaration ([§15.2.7](classes.md#1527-partial-type-declarations)) which is combined with any other partial class declarations for `Program` within the application. -- The synthesized method calls the `Main` method, passing its `string[]` parameter value as an argument if the `Main` method has such a parameter. -- If the `Main` method throws an exception, the exception is propagated by the synthesized method. -- Otherwise, the synthesized entry point waits for the returned task to complete, calling `GetAwaiter().GetResult()` on the task, using either the parameterless instance method or the extension method described by [§C.3](standard-library.md#c3-standard-library-types-not-defined-in-isoiec-23271). If the task fails, `GetResult()` will throw an exception, and this exception is propagated by the synthesized method. -- For a `Main` method with a return type of `System.Threading.Tasks.Task`, if the task completes successfully, the `int` value returned by `GetResult()` is returned from the synthesized method. +> *Note*: This means that a top-level statement has the same rights of access as a statement in the body of a static method defined in the class `Program` in the global namespace. *end note* -The ***effective entry point*** of an application is the entry point declared within the program, or the synthesized method if one is required as described above. The return type of the effective entry point is therefore always `void` or `int`. +The method name `«Main»` is a placeholder for an unspecified implementation provided name which is directly accessible only to the execution environment and cannot be referenced directly from within the application. Further there is no requirement that the name used is valid as a C# method name. -When an application is run, a new ***application domain*** is created. Several different instantiations of an application may exist on the same machine at the same time, and each has its own application domain. -An application domain enables application isolation by acting as a container for application state. An application domain acts as a container and boundary for the types defined in the application and the class libraries it uses. Types loaded into one application domain are distinct from the same types loaded into another application domain, and instances of objects are not directly shared between application domains. For instance, each application domain has its own copy of static variables for these types, and a static constructor for a type is run at most once per application domain. Implementations are free to provide implementation-defined policy or mechanisms for the creation and destruction of application domains. +> *Note*: However a representation of the name used can be obtained as a `string` during execution of a top-level statement if it invokes a method which uses the `CallerMemberName` attribute ([§23.5.6.4](attributes.md#23564-the-callermembername-attribute)). *end note* -Application startup occurs when the execution environment calls the application’s effective entry point. If the effective entry point declares a parameter, then during application startup, the implementation shall ensure that the initial value of that parameter is a non-null reference to a string array. This array shall consist of non-null references to strings, called ***application parameter***s, which are given implementation-defined values by the host environment prior to application startup. The intent is to supply to the application information determined prior to application startup from elsewhere in the hosted environment. +The `«statement_list»` is a placeholder for *statement_list* of the *compilation-unit*. -> *Note*: On systems supporting a command line, application parameters correspond to what are generally known as command-line arguments. *end note* +The parameter `args` is in scope within the top-level statements and not otherwise. Regular name conflict/shadowing rules apply. This parameter receives the application parameters (§entry-point-invocation). + +Async operations are allowed in top-level statements to the degree they are allowed in statements within a named async entry-point method. + +The replacement of the `«AsyncAndReturnType»` placeholder in the method signature is determined based on content of the top-level statements, as follows: + +| **Top-level statements contain** | **Generated signature** +| ----------------------- | ------------------------------- +| No `await` or `return` with value | `static void «Main»(string[] args)` +| `return` with value only | `static int «Main»(string[] args)` +| `await` only | `static async Task «Main»(string[] args)` +| `await` and `return` with value | `static async Task «Main»(string[] args)` -If the effective entry point’s return type is `int`, the return value from the method invocation by the execution environment is used in application termination ([§7.2](basic-concepts.md#72-application-termination)). +These generated signatures meet the requirements for named entry points (§named-entry-points) and therefore `«Main»` is a candidate entry point. -Other than the situations listed above, entry point methods behave like those that are not entry points in every respect. In particular, if the entry point is invoked at any other point during the application’s lifetime, such as by regular method invocation, there is no special handling of the method: if there is a parameter, it may have an initial value of `null`, or a non-`null` value referring to an array that contains null references. Likewise, the return value of the entry point has no special significance other than in the invocation from the execution environment. +> *Note*: These signatures include no declared accessibility ([§7.5.2](basic-concepts.md#752-declared-accessibility)). However an implementation may include declared accessibility – as accessibility is ignored for entry point methods (§named-entry-points) the method would still be semantically equivalent. -## 7.2 Application termination +### §externally-defined-entry-point Externally defined entry point -The return of control to the execution environment is known as ***application termination***. +An implementation may provide a mechanism external to this specification to specify a candidate entry point. -If the return type of the application’s effective entry point method is `int` and execution completes without resulting in an exception, the value of the `int` returned serves as the application’s ***termination status code***. The purpose of this code is to allow communication of success or failure to the execution environment. If the return type of the effective entry point method is `void` and execution completes without resulting in an exception, the termination status code is `0`. +If that mechanism identifies a type within the program then the candidate entry point is determined as specified for named entry points (§named-entry-points). -If the effective entry point method terminates due to an exception ([§22.4](exceptions.md#224-how-exceptions-are-handled)), the exit code is implementation-defined. Additionally, the implementation may provide alternative APIs for specifying the exit code. +If that mechanism identifies a method within the program then the method may have any name but otherwise must meet the requirements specified for named entry points (§named-entry-points). + +The external mechanism may only specify a single candidate entry point. + +A candidate entry point specified by an external mechanism takes precedence in entry point selection (§entry-point-selection). + +### §entry-point-selection Entry point selection + +It is a compile-time error if there are no candidate entry points. + +Otherwise the entry point is selected from the candidates: + +- If one of the candidates is specified by an external mechanism (§externally-defined-entry-point) it is selected as the entry point; +- Otherwise, iff one of the candidates is defined by top-level statements (§using-top-level-statements) it is selected as the entry point; +- Otherwise: + - If any of the candidates have a return type of `int` or `void` then any candidates having a return type of `System.Threading.Tasks.Task` or `System.Threading.Tasks.Task` are removed from the candidate pool. + - If there is a single remaining candidate it is selected as the entry point. + - Otherwise the entry point cannot be determined and a compile-time error shall be reported. + +The entry point selected at compile-time is invoked at runtime as part of application startup (§entry-point-invocation). + +### §entry-point-invocation Entry point invocation + +If the entry point declares a parameter, then the implementation shall as the initial value of that parameter provide a non-null reference to a string array. This array shall consist of non-null references to zero or more strings, called ***application parameter***s, which are given implementation-defined values by the host environment prior to application startup. + +> *Note*: On systems supporting a command line, application parameters correspond to what are generally known as command-line arguments. *end note* + +The application startup and termination process is semantically equivalent to the following steps: + +- An application run is started by either: + - Invoking ([§12.8.10](expressions.md#12810-invocation-expressions)) the entry-point method, if its return type is `void` or `int`; or + - Awaiting ([§12.9.9](expressions.md#1299-await-expressions)) the result of invoking the entry-point method, if its return type is a `Task` type. + - In either case if the entry point requires an argument the application parameter array is supplied as its value. + +> *Note*: Invoking the entry-point method will cause the static constructor, if any, of the enclosing type to be executed first ([§15.12](classes.md#1512-static-constructors), [§16.4.10](structs.md#16410-static-constructors)). *end note* + +- The application is terminated + - If the run results in an `int` value it serves as the termination status code; + - Otherwise, if the run results in no return value the termination status code is `0`; + - Otherwise, if the run terminates due to an exception ([§22.4](exceptions.md#224-how-exceptions-are-handled)), the exit code is implementation-defined. Additionally, the implementation may provide alternative APIs for specifying the exit code. Whether or not finalizers ([§15.13](classes.md#1513-finalizers)) are run as part of application termination is implementation-defined. @@ -604,8 +679,8 @@ The ***scope*** of a name is the region of program text within which it is possi - The scope of a namespace member declared by a *namespace_member_declaration* ([§14.6](namespaces.md#146-namespace-member-declarations)) with no enclosing *namespace_declaration* is the entire program text. - The scope of a namespace member declared by a *namespace_member_declaration* within a *namespace_declaration* whose fully qualified name is `N`, is the *namespace_body* of every *namespace_declaration* whose fully qualified name is `N` or starts with `N`, followed by a period. -- The scope of a name defined by an *extern_alias_directive* ([§14.4](namespaces.md#144-extern-alias-directives)) extends over the *using_directive*s, *global_attributes* and *namespace_member_declaration*s of its immediately containing *compilation_unit* or *namespace_body*. An *extern_alias_directive* does not contribute any new members to the underlying declaration space. In other words, an *extern_alias_directive* is not transitive, but, rather, affects only the *compilation_unit* or *namespace_body* in which it occurs. -- The scope of a name defined or imported by a *using_directive* ([§14.5](namespaces.md#145-using-directives)) extends over the *global_attributes* and *namespace_member_declaration*s of the *compilation_unit* or *namespace_body* in which the *using_directive* occurs. A *using_directive* may make zero or more namespace or type names available within a particular *compilation_unit* or *namespace_body*, but does not contribute any new members to the underlying declaration space. In other words, a *using_directive* is not transitive but rather affects only the *compilation_unit* or *namespace_body* in which it occurs. +- The scope of a name defined by an *extern_alias_directive* ([§14.4](namespaces.md#144-extern-alias-directives)) extends over the *using_directive*s, *global_attributes*, *statement_list*s, and *namespace_member_declaration*s of its immediately containing *compilation_unit* or *namespace_body*. An *extern_alias_directive* does not contribute any new members to the underlying declaration space. In other words, an *extern_alias_directive* is not transitive, but, rather, affects only the *compilation_unit* or *namespace_body* in which it occurs. +- The scope of a name defined or imported by a *using_directive* ([§14.5](namespaces.md#145-using-directives)) extends over the *global_attributes*, *statement_list*s, and *namespace_member_declaration*s of the *compilation_unit* or *namespace_body* in which the *using_directive* occurs. A *using_directive* may make zero or more namespace or type names available within a particular *compilation_unit* or *namespace_body*, but does not contribute any new members to the underlying declaration space. In other words, a *using_directive* is not transitive but rather affects only the *compilation_unit* or *namespace_body* in which it occurs. - The scope of a type parameter declared by a *type_parameter_list* on a *class_declaration* ([§15.2](classes.md#152-class-declarations)) is the *class_base*, *type_parameter_constraints_clause*s, and *class_body* of that *class_declaration*. > *Note*: Unlike members of a class, this scope does not extend to derived classes. *end note* - The scope of a type parameter declared by a *type_parameter_list* on a *struct_declaration* ([§16.2](structs.md#162-struct-declarations)) is the *struct_interfaces*, *type_parameter_constraints_clause*s, and *struct_body* of that *struct_declaration*. @@ -710,6 +785,14 @@ Within the scope of a local variable, it is a compile-time error to refer to the > > *end note* +As described in §using-top-level-statements, top-level source tokens are enclosed by the generated entry-point method. + +For the purpose of simple-name evaluation, once the global namespace is reached, first, an attempt is made to evaluate the name within the generated entry-point method and only if this attempt fails is the evaluation within the global namespace declaration performed. + +This could lead to name shadowing of namespaces and types declared within the global namespace as well as to shadowing of imported names. + +If the simple name evaluation occurs outside of the top-level statements and the evaluation yields a top-level local variable or function, a compile-time error results. + ### 7.7.2 Name hiding #### 7.7.2.1 General @@ -1050,7 +1133,7 @@ C# employs automatic memory management, which frees developers from manually all The garbage collector maintains information about object usage, and uses this information to make memory management decisions, such as where in memory to locate a newly created object, when to relocate an object, and when an object is no longer in use or inaccessible. -Like other languages that assume the existence of a garbage collector, C# is designed so that the garbage collector might implement a wide range of memory management policies. C# specifies neither a time constraint within that span, nor an order in which finalizers are run. Whether or not finalizers are run as part of application termination is implementation-defined ([§7.2](basic-concepts.md#72-application-termination)). +Like other languages that assume the existence of a garbage collector, C# is designed so that the garbage collector might implement a wide range of memory management policies. C# specifies neither a time constraint within that span, nor an order in which finalizers are run. Whether or not finalizers are run as part of application termination is implementation-defined ([§7.1](basic-concepts.md#71-application-startup-and-termination)). The behavior of the garbage collector can be controlled, to some degree, via static methods on the class `System.GC`. This class can be used to request a collection to occur, finalizers to be run (or not run), and so forth. diff --git a/standard/classes.md b/standard/classes.md index ce156aa8d..b0de2fdb4 100644 --- a/standard/classes.md +++ b/standard/classes.md @@ -3083,7 +3083,7 @@ If a defining declaration but not an implementing declaration is given for a par - Expressions occurring as part of an invocation of `M` do not affect the definite assignment state ([§9.4](variables.md#94-definite-assignment)), which can potentially lead to compile-time errors. -- `M` cannot be the entry point for an application ([§7.1](basic-concepts.md#71-application-startup)). +- `M` cannot be the entry point for an application ([§7.1](basic-concepts.md#71-application-startup-and-termination)). Partial methods are useful for allowing one part of a type declaration to customize the behavior of another part, e.g., one that is generated by a tool. Consider the following partial class declaration: @@ -5154,7 +5154,7 @@ The static constructor for a closed class executes at most once in a given appli - An instance of the class is created. - Any of the static members of the class are referenced. -If a class contains the `Main` method ([§7.1](basic-concepts.md#71-application-startup)) in which execution begins, the static constructor for that class executes before the `Main` method is called. +If a class contains the application entry point ([§7.1](basic-concepts.md#71-application-startup-and-termination)) the static constructor for that class executes before the entry point is called. To initialize a new closed class type, first a new set of static fields ([§15.5.2](classes.md#1552-static-and-instance-fields)) for that particular closed type shall be created. Each of the static fields shall be initialized to its default value ([§15.5.5](classes.md#1555-field-initialization)). Following this: diff --git a/standard/interfaces.md b/standard/interfaces.md index a84b055e2..f65321942 100644 --- a/standard/interfaces.md +++ b/standard/interfaces.md @@ -487,14 +487,14 @@ This clause augments the description of static constructors in classes [§15.12] The static constructor for a closed ([§8.4.3](types.md#843-open-and-closed-types)) interface executes at most once in a given application domain. The execution of a static constructor is triggered by the first of the following actions to occur within an application domain: - Any of the static members of the interface are referenced. -- Before the `Main` method is called for an interface containing the `Main` method ([§7.1](basic-concepts.md#71-application-startup)) in which execution begins. +- Before the entry-point method is called for an interface containing the application entry-point method ([§7.1](basic-concepts.md#71-application-startup-and-termination)). - That interface provides an implementation for a member, and that implementation is accessed as the most specific implementation ([§19.4.10](interfaces.md#19410-most-specific-implementation)) for that member. > *Note*: In the case where none of the preceding actions take place, the static constructor for an interface may not execute for a program where instances of types that implement the interface are created and used. *end note* To initialize a new closed interface type, first a new set of static fields for that particular closed type is created. Each of the static fields is initialized to its default value. Next, the static field initializers are executed for those static fields. Finally, the static constructor is executed. -> *Note*: See [§19.4.2](interfaces.md#1942-interface-fields) for an example of using various kinds of static members (including a Main method) declared within an interface. *end note* +> *Note*: See [§19.4.2](interfaces.md#1942-interface-fields) for an example of using various kinds of static members (including an entry-point method) declared within an interface. *end note* ### 19.4.9 Interface nested types diff --git a/standard/namespaces.md b/standard/namespaces.md index 51cfad6ec..7085643a0 100644 --- a/standard/namespaces.md +++ b/standard/namespaces.md @@ -8,24 +8,26 @@ Using directives ([§14.5](namespaces.md#145-using-directives)) are provided to ## 14.2 Compilation units -A *compilation_unit* consists of zero or more *extern_alias_directive*s followed by zero or more *using_directive*s followed by zero or one *global_attributes* followed by zero or more *namespace_member_declaration*s. The *compilation_unit* defines the overall structure of the input. +A C# program consists of one or more compilation units. When a C# program is compiled, all of the compilation units are processed together. Thus, compilation units can depend on each other, possibly in a circular fashion. + +The structure of a single compilation unit is defined by *compilation_unit*: ```ANTLR compilation_unit : extern_alias_directive* using_directive* global_attributes? - namespace_member_declaration* + statement_list? namespace_member_declaration* ; ``` -A C# program consists of one or more compilation units. When a C# program is compiled, all of the compilation units are processed together. Thus, compilation units can depend on each other, possibly in a circular fashion. +The *extern_alias_directive*s ([§14.4](namespaces.md#144-extern-alias-directives)) of a compilation unit affect the *using_directive*s, *global_attributes* and *namespace_member_declaration*s of that compilation unit, but have no effect on other compilation units. -The *extern_alias_directive*s of a compilation unit affect the *using_directive*s, *global_attributes* and *namespace_member_declaration*s of that compilation unit, but have no effect on other compilation units. - -The *using_directive*s of a compilation unit affect the *global_attributes* and *namespace_member_declaration*s of that compilation unit, but have no effect on other compilation units. +The *using_directive*s ([§14.5](namespaces.md#145-using-directives)) of a compilation unit affect the *global_attributes* and *namespace_member_declaration*s of that compilation unit, but have no effect on other compilation units. The *global_attributes* ([§23.3](attributes.md#233-attribute-specification)) of a compilation unit permit the specification of attributes for the target assembly and module. Assemblies and modules act as physical containers for types. An assembly may consist of several physically separate modules. -The *namespace_member_declaration*s of each compilation unit of a program contribute members to a single declaration space called the global namespace. +The optional *statement_list* ([§13.3.2](statements.md#1332-statement-lists)) specifies statements to be used as an application entry point (§using-top-level-statements). Only one compilation unit in a program may contain a *statement_list*. + +The *namespace_member_declaration*s ([§14.6](namespaces.md#146-namespace-member-declarations)) of each compilation unit of a program contribute members to a single declaration space called the global namespace. > *Example*: > diff --git a/standard/portability-issues.md b/standard/portability-issues.md index fb6305cb8..123b0a2fe 100644 --- a/standard/portability-issues.md +++ b/standard/portability-issues.md @@ -28,11 +28,11 @@ A conforming implementation is required to document its choice of behavior in ea 1. The behavior when an identifier not in Normalization Form C is encountered. ([§6.4.3](lexical-structure.md#643-identifiers)) 1. The maximum value allowed for `Decimal_Digit+` in `PP_Line_Indicator`. ([§6.5.8](lexical-structure.md#658-line-directives)) 1. The interpretation of the *input_characters* in the *pp_pragma-text* of a #pragma directive. ([§6.5.10](lexical-structure.md#6510-pragma-directives)) -1. The values of any application parameters passed to `Main` by the host environment prior to application startup. ([§7.1](basic-concepts.md#71-application-startup)) -1. The mechanism for determining whether a program is compiled as a class library or as an application. ([§7.1](basic-concepts.md#71-application-startup)) -1. The policy or mechanisms used by an implementation for the creation and destruction of application domains. ([§7.1](basic-concepts.md#71-application-startup)) -1. The exit code if the effective entry point method terminates due to an exception. ([§7.2](basic-concepts.md#72-application-termination)) -1. Whether or not finalizers are run as part of application termination. ([§7.2](basic-concepts.md#72-application-termination), [§7.9](basic-concepts.md#79-automatic-memory-management)) +1. The values of any application parameters passed to the application entry-point method by the host environment prior to application startup. ([§7.1](basic-concepts.md#71-application-startup-and-termination)) +1. The mechanism for determining whether a program is compiled as a class library or as an application. ([§7.1](basic-concepts.md#71-application-startup-and-termination)) +1. The policy or mechanisms used by an implementation for the creation and destruction of application domains. ([§7.1](basic-concepts.md#71-application-startup-and-termination)) +1. The exit code if the application terminates due to an exception. ([§7.1](basic-concepts.md#71-application-startup-and-termination)) +1. Whether or not finalizers are run as part of application termination. ([§7.1](basic-concepts.md#71-application-startup-and-termination), [§7.9](basic-concepts.md#79-automatic-memory-management)) 1. Whether APIs allow a finalizer to be run more than once. ([§7.9](basic-concepts.md#79-automatic-memory-management)) 1. The API surface provided by `Expression` beyond the requirement for a `Compile` method. ([§8.6](types.md#86-expression-tree-types)) 1. The precise structure of the expression tree, as well as the exact process for creating it, when an anonymous function is converted to an expression-tree. ([§10.7.3](conversions.md#1073-evaluation-of-lambda-expression-conversions-to-expression-tree-types)) @@ -53,6 +53,7 @@ A conforming implementation is required to document its choice of behavior in ea ## B.4 Unspecified behavior +1. The name of the entry-point method generated to contain top-level statements (§using-top-level-statements). 1. The time at which the finalizer (if any) for an object is run, once that object has become eligible for finalization ([§7.9](basic-concepts.md#79-automatic-memory-management)). 1. The representation of `true` ([§8.3.9](types.md#839-the-bool-type)). 1. The value of the result when converting out-of-range values from `float` or `double` values to an integral type in an `unchecked` context ([§10.3.2](conversions.md#1032-explicit-numeric-conversions)). diff --git a/tools/GrammarTesting/Tests/Parsing/Samples/v9/Top-level statements/ReadMe.md b/tools/GrammarTesting/Tests/Parsing/Samples/v9/Top-level statements/ReadMe.md new file mode 100644 index 000000000..716600f9d --- /dev/null +++ b/tools/GrammarTesting/Tests/Parsing/Samples/v9/Top-level statements/ReadMe.md @@ -0,0 +1,3 @@ +# Sample: Top-level statements + +Simple sample which uses top-level statements, calls `Main`, and displays the compiler-generated name for the TLS method. diff --git a/tools/GrammarTesting/Tests/Parsing/Samples/v9/Top-level statements/Reference/sample.gruntree.red.txt b/tools/GrammarTesting/Tests/Parsing/Samples/v9/Top-level statements/Reference/sample.gruntree.red.txt new file mode 100644 index 000000000..289458b2a --- /dev/null +++ b/tools/GrammarTesting/Tests/Parsing/Samples/v9/Top-level statements/Reference/sample.gruntree.red.txt @@ -0,0 +1,421 @@ +⎛ +⎜ prog +⎜ ⎛ +⎜ ⎜ compilation_unit +⎜ ⎜ ⎛ +⎜ ⎜ ⎜ using_directive +⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ using_namespace_directive +⎜ ⎜ ⎜ ⎜ using +⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ namespace_name +⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ identifier +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ System +⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ; +⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎝ +⎜ ⎜ ⎛ +⎜ ⎜ ⎜ using_directive +⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ using_namespace_directive +⎜ ⎜ ⎜ ⎜ using +⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ namespace_name +⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ namespace_or_type_name +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ identifier +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ System +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ . +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ identifier +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ Runtime +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ . +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ identifier +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ CompilerServices +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ; +⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎝ +⎜ ⎜ ⎛ +⎜ ⎜ ⎜ statement_list +⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ statement +⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ expression_statement +⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ statement_expression +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ invocation_expression +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ primary_expression +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ member_access +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ primary_expression +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ identifier +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ Console +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ . +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ identifier +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ WriteLine +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ( +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ argument_list +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ interpolated_regular_string_expression +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ 〔$"〕 +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ { +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ regular_interpolation +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ invocation_expression +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ primary_expression +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ identifier +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ GetName +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ( +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ) +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ } +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ 〔: args[0] = 〕 +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ { +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ regular_interpolation +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ element_access +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ primary_expression +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ identifier +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ args +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ [ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ argument_list +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ literal +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ 0 +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ] +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ } +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ 〔"〕 +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ) +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ; +⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ statement +⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ expression_statement +⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ statement_expression +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ invocation_expression +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ primary_expression +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ member_access +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ primary_expression +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ identifier +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ Program +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ . +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ identifier +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ Main +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ( +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ argument_list +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ identifier +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ args +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ) +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ; +⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ statement +⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ local_function_declaration +⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ return_type +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ class_type +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ string +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ local_function_header +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ identifier +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ GetName +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ( +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ parameter_list +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ fixed_parameter +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ attributes +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ attribute_section +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ [ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ attribute_list +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ identifier +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ CallerMemberName +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ] +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ type +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ class_type +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ string +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ identifier +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ memberName +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ default_argument +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ = +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ expression +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ literal +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ "" +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ) +⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ local_function_body +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ block +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ { +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ statement_list +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ return_statement +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ return +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ expression +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ identifier +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ memberName +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ; +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ } +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎝ +⎜ ⎜ ⎛ +⎜ ⎜ ⎜ namespace_member_declaration +⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ class_declaration +⎜ ⎜ ⎜ ⎜ partial +⎜ ⎜ ⎜ ⎜ class +⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ identifier +⎜ ⎜ ⎜ ⎜ ⎜ Program +⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ class_body +⎜ ⎜ ⎜ ⎜ ⎜ { +⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ class_member_declaration +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ method_declaration +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ method_modifiers +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ method_modifier +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ref_method_modifier +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ public +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ method_modifier +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ref_method_modifier +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ static +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ return_type +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ void +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ method_header +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ member_name +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ identifier +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ Main +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ( +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ parameter_list +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ fixed_parameter +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ type +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ array_type +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ non_array_type +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ class_type +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ string +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ rank_specifier +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ [ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ] +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ identifier +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ args +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ) +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ method_body +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ block +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ { +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ statement_list +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ expression_statement +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ statement_expression +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ invocation_expression +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ primary_expression +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ member_access +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ primary_expression +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ identifier +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ Console +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ . +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ identifier +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ WriteLine +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ( +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ argument_list +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ interpolated_regular_string_expression +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ 〔$"〕 +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ 〔Main: args[0] = 〕 +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ { +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ regular_interpolation +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ element_access +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ primary_expression +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ identifier +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ args +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ [ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ argument_list +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ literal +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ 0 +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ] +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ } +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ 〔"〕 +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ) +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ; +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ } +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎜ ⎜ } +⎜ ⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎜ ⎝ +⎜ ⎜ ⎝ +⎜ ⎝ +⎝ diff --git a/tools/GrammarTesting/Tests/Parsing/Samples/v9/Top-level statements/Reference/sample.stderr.txt b/tools/GrammarTesting/Tests/Parsing/Samples/v9/Top-level statements/Reference/sample.stderr.txt new file mode 100644 index 000000000..e69de29bb diff --git a/tools/GrammarTesting/Tests/Parsing/Samples/v9/Top-level statements/Reference/sample.tokens.txt b/tools/GrammarTesting/Tests/Parsing/Samples/v9/Top-level statements/Reference/sample.tokens.txt new file mode 100644 index 000000000..d74fd05cf --- /dev/null +++ b/tools/GrammarTesting/Tests/Parsing/Samples/v9/Top-level statements/Reference/sample.tokens.txt @@ -0,0 +1,86 @@ +[@0,0:4='using',<'using'>,1:0] +[@1,6:11='System',,1:6] +[@2,12:12=';',<';'>,1:12] +[@3,14:18='using',<'using'>,2:0] +[@4,20:25='System',,2:6] +[@5,26:26='.',<'.'>,2:12] +[@6,27:33='Runtime',,2:13] +[@7,34:34='.',<'.'>,2:20] +[@8,35:50='CompilerServices',,2:21] +[@9,51:51=';',<';'>,2:37] +[@10,54:60='Console',,4:0] +[@11,61:61='.',<'.'>,4:7] +[@12,62:70='WriteLine',,4:8] +[@13,71:71='(',<'('>,4:17] +[@14,72:73='〔$"〕',,4:18] +[@15,74:74='{',<'{'>,4:20] +[@16,75:81='GetName',,4:21] +[@17,82:82='(',<'('>,4:28] +[@18,83:83=')',<')'>,4:29] +[@19,84:84='}',<'}'>,4:30] +[@20,85:96='〔: args[0] = 〕',,4:31] +[@21,97:97='{',<'{'>,4:43] +[@22,98:101='args',,4:44] +[@23,102:102='[',<'['>,4:48] +[@24,103:103='0',,4:49] +[@25,104:104=']',<']'>,4:50] +[@26,105:105='}',<'}'>,4:51] +[@27,106:106='〔"〕',,4:52] +[@28,107:107=')',<')'>,4:53] +[@29,108:108=';',<';'>,4:54] +[@30,110:116='Program',,5:0] +[@31,117:117='.',<'.'>,5:7] +[@32,118:121='Main',,5:8] +[@33,122:122='(',<'('>,5:12] +[@34,123:126='args',,5:13] +[@35,127:127=')',<')'>,5:17] +[@36,128:128=';',<';'>,5:18] +[@37,131:136='string',<'string'>,7:0] +[@38,138:144='GetName',,7:7] +[@39,145:145='(',<'('>,7:14] +[@40,146:146='[',<'['>,7:15] +[@41,147:162='CallerMemberName',,7:16] +[@42,163:163=']',<']'>,7:32] +[@43,165:170='string',<'string'>,7:34] +[@44,172:181='memberName',,7:41] +[@45,183:183='=',<'='>,7:52] +[@46,185:186='""',,7:54] +[@47,187:187=')',<')'>,7:56] +[@48,189:189='{',<'{'>,7:58] +[@49,191:196='return',<'return'>,7:60] +[@50,198:207='memberName',,7:67] +[@51,208:208=';',<';'>,7:77] +[@52,210:210='}',<'}'>,7:79] +[@53,213:219='partial',<'partial'>,9:0] +[@54,221:225='class',<'class'>,9:8] +[@55,227:233='Program',,9:14] +[@56,235:235='{',<'{'>,10:0] +[@57,241:246='public',<'public'>,11:4] +[@58,248:253='static',<'static'>,11:11] +[@59,255:258='void',<'void'>,11:18] +[@60,260:263='Main',,11:23] +[@61,264:264='(',<'('>,11:27] +[@62,265:270='string',<'string'>,11:28] +[@63,271:271='[',<'['>,11:34] +[@64,272:272=']',<']'>,11:35] +[@65,274:277='args',,11:37] +[@66,278:278=')',<')'>,11:41] +[@67,284:284='{',<'{'>,12:4] +[@68,294:300='Console',,13:8] +[@69,301:301='.',<'.'>,13:15] +[@70,302:310='WriteLine',,13:16] +[@71,311:311='(',<'('>,13:25] +[@72,312:313='〔$"〕',,13:26] +[@73,314:329='〔Main: args[0] = 〕',,13:28] +[@74,330:330='{',<'{'>,13:44] +[@75,331:334='args',,13:45] +[@76,335:335='[',<'['>,13:49] +[@77,336:336='0',,13:50] +[@78,337:337=']',<']'>,13:51] +[@79,338:338='}',<'}'>,13:52] +[@80,339:339='〔"〕',,13:53] +[@81,340:340=')',<')'>,13:54] +[@82,341:341=';',<';'>,13:55] +[@83,347:347='}',<'}'>,14:4] +[@84,349:349='}',<'}'>,15:0] +[@85,350:349='',,15:1] diff --git a/tools/GrammarTesting/Tests/Parsing/Samples/v9/Top-level statements/Reference/sample.tree.red.txt b/tools/GrammarTesting/Tests/Parsing/Samples/v9/Top-level statements/Reference/sample.tree.red.txt new file mode 100644 index 000000000..b736c50ed --- /dev/null +++ b/tools/GrammarTesting/Tests/Parsing/Samples/v9/Top-level statements/Reference/sample.tree.red.txt @@ -0,0 +1 @@ +(prog (compilation_unit (using_directive (using_namespace_directive using (namespace_name (identifier System)) ;)) (using_directive (using_namespace_directive using (namespace_name (namespace_or_type_name (identifier System) . (identifier Runtime) . (identifier CompilerServices))) ;)) (statement_list (statement (expression_statement (statement_expression (invocation_expression (primary_expression (member_access (primary_expression (identifier Console)) . (identifier WriteLine))) ( (argument_list (interpolated_regular_string_expression 〔$"〕 { (regular_interpolation (invocation_expression (primary_expression (identifier GetName)) ( ))) } 〔: args[0] = 〕 { (regular_interpolation (element_access (primary_expression (identifier args)) [ (argument_list (literal 0)) ])) } 〔"〕)) ))) ;)) (statement (expression_statement (statement_expression (invocation_expression (primary_expression (member_access (primary_expression (identifier Program)) . (identifier Main))) ( (argument_list (identifier args)) ))) ;)) (statement (local_function_declaration (return_type (class_type string)) (local_function_header (identifier GetName) ( (parameter_list (fixed_parameter (attributes (attribute_section [ (attribute_list (identifier CallerMemberName)) ])) (type (class_type string)) (identifier memberName) (default_argument = (expression (literal ""))))) )) (local_function_body (block { (statement_list (return_statement return (expression (identifier memberName)) ;)) }))))) (namespace_member_declaration (class_declaration partial class (identifier Program) (class_body { (class_member_declaration (method_declaration (method_modifiers (method_modifier (ref_method_modifier public)) (method_modifier (ref_method_modifier static))) (return_type void) (method_header (member_name (identifier Main)) ( (parameter_list (fixed_parameter (type (array_type (non_array_type (class_type string)) (rank_specifier [ ]))) (identifier args))) )) (method_body (block { (statement_list (expression_statement (statement_expression (invocation_expression (primary_expression (member_access (primary_expression (identifier Console)) . (identifier WriteLine))) ( (argument_list (interpolated_regular_string_expression 〔$"〕 〔Main: args[0] = 〕 { (regular_interpolation (element_access (primary_expression (identifier args)) [ (argument_list (literal 0)) ])) } 〔"〕)) ))) ;)) })))) }))))) diff --git a/tools/GrammarTesting/Tests/Parsing/Samples/v9/Top-level statements/Reference/sample.tree.svg b/tools/GrammarTesting/Tests/Parsing/Samples/v9/Top-level statements/Reference/sample.tree.svg new file mode 100644 index 000000000..f2dfdf36c --- /dev/null +++ b/tools/GrammarTesting/Tests/Parsing/Samples/v9/Top-level statements/Reference/sample.tree.svg @@ -0,0 +1,985 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +interpolated_regular_string_expression + + + +0 + + + +statement + + + +local_function_header + + + +identifier + + + +non_array_type + + + +compilation_unit + + + +primary_expression + + + +; + + + +invocation_expression + + + +statement + + + +argument_list + + + +expression_statement + + + +( + + + +primary_expression + + + +; + + + +attribute_list + + + +using_directive + + + +local_function_body + + + +ref_method_modifier + + + +class_member_declaration + + + +type + + + +CompilerServices + + + +( + + + +using_namespace_directive + + + +element_access + + + +System + + + +expression_statement + + + +string + + + +primary_expression + + + +identifier + + + +) + + + +member_access + + + +Program + + + +〔Main:·args[0]·=·〕 + + + +( + + + +{ + + + +System + + + +Runtime + + + +block + + + +) + + + +identifier + + + +. + + + +static + + + +fixed_parameter + + + +] + + + +identifier + + + +Main + + + +namespace_name + + + +] + + + +element_access + + + +GetName + + + +return_type + + + +class_type + + + +( + + + +argument_list + + + +statement_list + + + +block + + + +args + + + +; + + + +prog + + + +〔"〕 + + + +memberName + + + +return + + + +{ + + + +} + + + +invocation_expression + + + +argument_list + + + +GetName + + + +identifier + + + +〔$"〕 + + + +identifier + + + +"" + + + +class_body + + + +method_body + + + +argument_list + + + +array_type + + + +{ + + + +) + + + +member_access + + + +identifier + + + +statement_expression + + + +invocation_expression + + + +invocation_expression + + + +using + + + +{ + + + +identifier + + + +using_directive + + + +[ + + + +; + + + +) + + + +string + + + +identifier + + + +method_modifier + + + +literal + + + +{ + + + +identifier + + + +identifier + + + +identifier + + + +Console + + + +primary_expression + + + +} + + + +; + + + +regular_interpolation + + + +return_statement + + + +class_type + + + +rank_specifier + + + +. + + + +statement + + + += + + + +} + + + +argument_list + + + +identifier + + + +attribute_section + + + +) + + + +method_header + + + +) + + + +identifier + + + +literal + + + +statement_expression + + + +default_argument + + + +[ + + + +using + + + +( + + + +〔:·args[0]·=·〕 + + + +parameter_list + + + +expression + + + +Console + + + +attributes + + + +string + + + +. + + + +identifier + + + +primary_expression + + + +parameter_list + + + +member_access + + + +identifier + + + +Main + + + +; + + + +0 + + + +args + + + +local_function_declaration + + + +fixed_parameter + + + +] + + + +〔$"〕 + + + +[ + + + +expression_statement + + + +( + + + +namespace_member_declaration + + + +WriteLine + + + +public + + + +using_namespace_directive + + + +args + + + +primary_expression + + + +. + + + +namespace_or_type_name + + + +identifier + + + +method_modifier + + + +} + + + +statement_list + + + +statement_list + + + +literal + + + +〔"〕 + + + +Program + + + +identifier + + + +primary_expression + + + +identifier + + + +CallerMemberName + + + +identifier + + + +method_modifiers + + + +args + + + +method_declaration + + + +class_declaration + + + +namespace_name + + + +class_type + + + +interpolated_regular_string_expression + + + +. + + + +} + + + +class + + + +primary_expression + + + +void + + + +return_type + + + +regular_interpolation + + + +] + + + +statement_expression + + + +[ + + + +ref_method_modifier + + + +regular_interpolation + + + +{ + + + +type + + + +expression + + + +} + + + +primary_expression + + + +member_name + + + +partial + + + +WriteLine + + + +memberName + + + +identifier + + \ No newline at end of file diff --git a/tools/GrammarTesting/Tests/Parsing/Samples/v9/Top-level statements/_Sample_Options.txt b/tools/GrammarTesting/Tests/Parsing/Samples/v9/Top-level statements/_Sample_Options.txt new file mode 100644 index 000000000..c3810f510 --- /dev/null +++ b/tools/GrammarTesting/Tests/Parsing/Samples/v9/Top-level statements/_Sample_Options.txt @@ -0,0 +1 @@ +-ms Rules -rt \ No newline at end of file diff --git a/tools/GrammarTesting/Tests/Parsing/Samples/v9/Top-level statements/sample.cs b/tools/GrammarTesting/Tests/Parsing/Samples/v9/Top-level statements/sample.cs new file mode 100644 index 000000000..ddbc503c5 --- /dev/null +++ b/tools/GrammarTesting/Tests/Parsing/Samples/v9/Top-level statements/sample.cs @@ -0,0 +1,15 @@ +using System; +using System.Runtime.CompilerServices; + +Console.WriteLine($"{GetName()}: args[0] = {args[0]}"); +Program.Main(args); + +string GetName([CallerMemberName] string memberName = "") { return memberName; } + +partial class Program +{ + public static void Main(string[] args) + { + Console.WriteLine($"Main: args[0] = {args[0]}"); + } +} \ No newline at end of file