| 摘要: |
| SAQ系统是一个进行软件规约获取、检验和复用的实验系统,其中以上下文无关文法表示的概念是规约的一部分.SAQ要求将概念的词法和句法定义结合在一个上下文无关文法中.如果用常规的上下文无关文法描述诸如程序设计语言和自然语言等一些复杂概念的语法,则需要把诸如空格和回车等没有实质意义的分隔符包含到语法中去(这种描述方法称为朴素表示法),使得语法描述很累赘.为此,作者设计了一种特殊的上下文无关文法,它把通常上下文无关文法定义中的非终极符集合和终极符集合进行细化.用这种文法可以相对简洁地描述程序语言和自然语言等复杂概 |
| 关键词: 上下文无关语言,语法分析,语法树. |
| DOI: |
| 分类号: |
| 基金项目:本文研究得到国家自然科学基金、国家863高科技项目基金和国家“九五”攻关计划基金的支持. |
|
| A Special Kind of Context Free Grammars and Their Parsing |
|
ZHANG Rui-ling
|
| Abstract: |
| SAQ is an experimental system to perform acquisition, verification and reusing of formal specification, in which the lexical and syntactic definitions of one concept should be integrated into one context-free grammar. If employed conventional context-free grammars to describe the overall definitions of complicated concepts such as natural languages and programming languages, separators such as spaces and carrier returns should be included and the definitions should be very messy. To solve this problem, a special kind of context-free grammars is presented. The grammars are obtained by dividing the set of non-terminals and the set of terminals of conventional context-free grammars into two respectively. As a result, the grammatical definitions of complicated concepts are relatively neat; at the same time, lexical analysis and syntax analysis can be integrated into one parsing process. In addition, the authors present the corresponding parsing and derivation tree construction algorithms, which are obtained on the basis of the general parsing method of Earley and its corresponding algorithm of construction of rightmost derivation respectively. |
| Key words: Context-free grammar, parsing, derivation tree. |