1 Introduction
Ordinary programming people have accepted formal grammar description (such as BNF and its variants), but the form is not like this. The general people think that the strange style and mathematical symbols in the form of the form can only be expert Use, in fact, you can solve this problem by better symbols and styles using readability.
But the problem with deeper form of semantics is that they are based on the concept of understanding the programming language. For example, the concepts such as control flow, storage, and binding are only indirectly specified. They are specified in the alleged semantics; they are specified in the operation semantic (ordinary). The result is that the semantic specification has become difficult to understand, which is almost unaccompraciated for large specifications.
The Action semantics is developed by Peter Mosses and is further improved by David A. Watt. Semantics of a language is specified by behavior (Actions), which directly reflects the general operation concept in the programming language. Therefore, there is such some original behaviors, such as: storage value, identical, test Boolean, and so on. The combination of behavior reflects the sequential, select, and iterative control flow. In addition, these behaviors are written in English symbols. All this makes it easier to read and understand the specifications described using behavioral semantics. These specifications are modular, and they are more likely to reflect the changes in the programming language and can be multiplexed in the relevant language specification.
One programming language of the programming language can be understood by two layers abstraction. The upper layer is a specification of the language, which is represented by actions. The bottom layer is the specifications of behavioral itself. Readers generally study the specifications of the upper layer. For this purpose, behavior is very important in intuition. Behavior is designed to be easily understood. The purpose of studying the underlying specification is to meet the needs of users in intuitional understanding.
2. Background
2..
In the programming researchers, the semantics are widely used, but this framework has some problems, and behavioral semantics is for these issues, especially for an actual programming language, alone despite very elegant and powerful, but The language of Pascal and C is very serious.
For example, a modification and extension of a description language requires redefine from the semantic domain, the original semantic equation requires redefining. Another quigumer issue is difficult to find basic concepts such as execution sequence, binding range from an alleged description. The following reasons for these issues have the following points:
1. In an allegation description, the definition of Chinese language is global visible;
2. Use the operator to specify the semantic entity very dependent on domain definitions;
3. All programming concepts are protected into a pure function;
So how do you alleviate the above questions?
1. Describe the modularization
2. Introducing symbols, definitions of these symbols rather than use, need to change in the domain to change;
Introduce symbols for all basic concepts in the programming language, such as: binding range, value storage, communication between concurrent processes, etc.
3. Behaviors Semantics
The study of behavioral semantics originated from the symmetric semantics. Behaviors semantics maintain two major features of the semantics:
(1) Use the above version of the law to define the abstract grammar tree;
(2) Use semantic equation to induce a set of composite semantics, and shoot the syntax tree into semantic entities;
There are three types of semantic entities in behavioral semantics: action, data, yielders. The main entity is Action, Data and Yielders are from the substitute. The symbols used to specify an action and its subsequent semantic entities are called behavioral notation.
The Action is essentially a dynamic can be calculated. An Action execution directs the processing behavior of the information, and reflects the calculated progressive essential: each step of Action may access or change the current information. Yielders occurs when Action Access but does not change information, and the evaluation of Yielders causes a DATA entity (including a special entity to represent undefined). 3.1. Behaviors Semantic Description (ASD)
A behavioral semantic description (ASD) consists of three main parts, which are used to specify abstract syntax, semantic functions, and semantic entities, and specify them into mutually separated modules, which may be divided into sub-modules in a large specification. . Just like we divide the article into the section section. Each module has a title, and it must be self-contained. In this sense, it is necessary to define there in a module. Of course, if a module wants to use the symbol defined in the module, it does not need to be defined in again, only the title is required to reference. Similar is a sub-module when using the common symbols in the module. We also only specify symbols in the module and then inherit in its sub-module. The modular structure described by a behavior semantic description is defined as follows:
Abstract Syntax
Semantic functions
Need: Abstract Syntax, Semantic Entities
Semantic Entities
Generally speaking, the title of the module should reflect the purpose of the module. Abstract syntax modules and semantic solid modules are self-contained and can be used independently. On the other hand, the semantic function module needs to use the symbols introduced in the other module.
This contributes to the modular division of semantics description. For example, we can divide the abstract syntax module into a sub-module representing an expression, a declared. Such divisions can also be used on the corresponding semantian function module. We can divide the semantic entities into submodules for processing numbers, arrays, procedures. These submodules can only be used in other semantic descriptions only on other semantic descriptions only need to be small modifications.
The module's segmentation does not require a reference to the module that has been protocol. A module reference implies this reference to all submodules of this module, but the dependencies between any new submodules must be specified, of course, this may make the segmentation work very complicated. We take the submodules
We allow mutual dependence between modules, and the order between them is not important. For example: Declarations of the process in abstract syntax is associated with Statements, while Statements blocks involve Declarations, which reflects to interdependence in the module. Similarly, it is similar to the relevant part of semantic equation. The previous module framework emphasizes strict inheritance relationships, which is forbidden to interdependent.
Related to this is that we can freely express the modules in the way the readers. The most desirable statement in the semantic description is the first abstract syntax first, then the semantic function, and finally the semantic entity. Here, it is assumed that the semantic entity is carefully selected, and the interpretation of it is very dependent on the symbol used to use. If the semantic entity appears before the semantic function, it is difficult to understand it independently of its use.
Of course we can arrange their order because they have no effect on their specified entities. We can gradually improve a module by combining several incomplete modules. For the sake of clarity, a module If the same name is with the previous module, then the instructions should be displayed later, and one of the previous continues, for example, we can introduce a symbol in a module, then in another module with the same name. Specify its most essential properties in it. You can also use this similar function to use extended submodules, of course, this is likely to make the dependencies between the modules become complicated.
An example of an extreme incomplete specification is only the structure of the module is given, and the definition of the entire entity symbol is placed in another module. For example, the ASD given above is the incomplete specification such as a good definition. Such an outline is particularly useful when it involves many modules in a specification. Finally, we introduce several marking methods that indicate a module of another module. For small specifications, the arrangement of the zigzag shape is sufficient to illustrate this nested relationship. For large specifications, this is used in such a form, wherein the top layer module is used. Or use, is the title of the n-layer module, allowing a para-paragraph of non-formal text between two formulated specifications, readers can distinguish them according to the fonts, which is difficult in other formal frameworks. .
3.1.1. Abstract syntax
The reference manual for programming language is generally used in formal contextual unlicensed, extended regular expressions to specify specific grammar. A formal formal method contains a set of generated types involving some endors and non-end. The formal chemical method has good palatability, such as readability, modificability. Abstract grammar also adopted these concepts.
3.1.2. Semantic function
In Action semantics, we use semantic equation to specify the language function. Each equality defines a particular type of semantic to a phrase based on a semantic entity. The ingredients in the semantic function are very obvious in semantic equation.
In the sense of mathematics, a set of semantic equations is a simple summary definition that maps the syntax into semantics. It is also possible to simply see a specification, set how to translate symbols in programming languages into semantic entities.
A semantic function always has a syntax parameter and produces a semantic entity. The symbols used to specify the language function can be freely selected, the right side of the semantic function is the standard symbol of Action and Data in the Action semantic, which is all formal.
3.1.3. Semantic entity
3.1.3.1. Actions
The execution of an action may be part of an enclosed action, namely: Completes, representing normal termination; Escapes, represents an exception termination; Fails, indicates a choice; or Diverges. Action can be used to represent the semantics of the program: the execution of the Action represents the possible behavior of the program. In addition, Action can also be used to represent some components of the composition, such as statements, expressions, and the like.
An Action may be uns determined, in the case of an identical initial information, can be performed in different execution. Non-determinism indicates the implementation, and the execution of the program may differ from the same time as the implementation method is different, and the information processed when the action executes can be divided into the following categories:
- TRANSIENT: Represents intermediate results;
- Scoped: Binds the symbol to the data, represents the symbol table;
- Stable: The data in the storage unit indicates that the value is assigned to the variable;
- Permanent: Data transmitted in a distributed action;
The Transient information is available at the action. Instead, scoped generally is valid throughout the action, although it is possible to shield it by the Subaction. Stable can be changed at the time that it could not be blocked, it will last until it is destroyed. Permanent can't even be changed, can only be expanded. When an Action is executed, Transient can only be available in the case of Completion or Escape. A scoped message can only be generated in the event of an action completion. The opposite to Stable changes and the extension of Permanet can only be done when the action is executed.
Different types of information lead to so-called Action Spends (Facet) generation, protesting only one type of information at a certain moment: - Basic face, independent processing information (control flow);
- Functional perspective, handle information for transient types (Actions are subject to or provide data);
- DECLARATIVE surface, handle information for scoped types (ActionS acceptance or processing binding);
- Imperative strip, processing the Stable type information (ActionS assignment or reclaiming the storage unit and modify the data in the storage unit);
- Communicative Spends, handle the Permanent type information (ActionS is sent or accepted in the buffer and provides a contract for Agents).
These faces are independent. For example, changing the value in a memory cell does not affect the binding of this storage unit.
The standard Action symbol consists of atomic Action and Action Combinator. Each atom Action is single-faceted, only in an expanded influence, although the Yielders it contains may involve different types of information.
The Action combination determines the control flow and information stream of each of the combined action, which allows expressions that express multiple faces, such as an Action not only requires allocating a storage unit, and also requires the memory unit to identify.
Only the action of the FUNCTION surface is closely related to the mathematical pure part of the mathematical, and the difference is that this Action is executed may be Escape, Fail, Completion and DEVERGING.
3.1.3.2. Data
The information processing of the Action is composed of data items, which can be accessed by the organization after organization. DATA can include several similar mathematical entities such as boolean, numbers, characters, strings, tables, collections, and diagrams. It can also contain purely used to calculate, such as tags, units, and Agents, etc. The Action itself is not DATA, but they can synthesize, which is called Abstractions, which is DATA, and can also be used as an action. The new DATA type can be introduced to reflect special information.
3.1.3.3. Yielders
Yielders is an entity, Action can be evaluated to evaluate it to generate DATA, and the generated DATA depends on the current information, for example, given temporary information, the acceptable binding, buffer The state, etc. The assessment does not affect the current information. Applications to Yielders can generate composite Yielders.
4. Prospect
We have introduced the basic theory of Action semantics. Let's introduce about its research prospects:
First, continue to develop a proof operator based on asynchronous communication and messaging on an action of an action.
In addition, it is necessary to develop a unified Action symbol set and whether to consider whether "Yielders" is considered as a sub-action type.
Third, it is not clear whether it is allowed to use Action semantic users to change the operational semantics of the Action symbol, or add a new Action combination subsidiary and atom Action. If this is allowed, then you need to proof all Action symbol rules again. The structured operation of the current Action symbol is difficult to modify, and another option is selection may be a good choice.
4 Conclusion
Compare the symmetry, we can find that Action semantics is successful in the following aspects:
- Positiveness: Action semantic descriptor is easy to read, so the vast majority of errors can be avoided.
- Understandable: In practice, the understandability of the symmetry described in practice is poor, even if the Greek alphabet is replaced in the meaningful symbol, and the Action semantic descriptor can be understood by a general programmer. - Modularity: Always modularly do not modular ideas in the description of the semantics, so changes in the entire semantic equation in semantic domains or description styles. The Action semantic descriptor is highly modular.
- Scalability: Due to the above reasons, the symptoms have no ability to describe a large language, but Action semantics can be easier to do this.
references
1. P. D. Mosses. Denotational SEMENTICS, Handbook of theoretical Computer Science, Volume B, Chapter 11. Elsevier Science Publishers, Amsterdam; and Mit Press, 1990.
2. D. A. Schmidt, DNOTATIONAL SEMANTICS: A Methodology for Language Development, Allyn & Bacon, 1986.
3. J. E. Stoy, Denotational Semantics: The Scott-Strachey Approach To Programming Language Theory, Mit Press, 1977.
4. J. Alves-Foss, Editor. Formal Syntax and Semantics of Java, Volme 1532 of Lecture Notes In Computer Science. Springer-Verlag, 1999.
5. J. Alves-Foss and F. S. Lam. Dynamic Denotational Semantics of Java, P201 - 240. Springer- Verlag, 1999.
6. E. BORGER AND W. Schulte. A Programmer Friendly Modular definition of the semantics of java, p353-404, springer-verlag, 1999.
7. J. Gosling, B. Joy, And G. Steele, The Java Language Specification. Addison-Wesley, 1996.
8. SB Lassen, Pd Mosses, And Da Watt, An Introduction To AN-2: The Proposed New Version of Action Notation, Digital Fountain, San Francisco, Brics & Dept. of Computer Science, U. of Aarhus, Denmark, Dept. Of Computer Science, U. Of GlasGow, Scotland, 2000