next up previous
Next: 1.2.2 Semantic functions Up: 1.2 Basics of action Previous: 1.2 Basics of action

1.2.1 Abstract syntax

Abstract syntax defines the grammar of the language. It uses a variant of BNF. An example is given below [Mos96]:


Table 1: An example of abstract syntax
\begin{ttfamily}
\centerline{
\begin{tabular}{l} module: Abstract Syntax. gramma...
... endgrammar. closed. endmodule: Abstract
Syntax. \end{tabular} } \end{ttfamily}


The grammar is easy to read and understand. However, notice that this description is very language specific. I.e., in Pascal, this specification may be correct; but in C, the conditional control has another appearance ``if (...) {...} else {...}''. This means even though the syntax and semantics of some statements are alike in another language, it is unlikely that it can reuse the existing specification. This is why people have to rewrite the whole module in order to change all these lexical symbols.

To get out of this difficulty, a recent suggestion raises the issue of separating the description into two layers. This will be discussed in the latter part of this paper.



Thomas Feng 2003-04-18