Summary: | 博士 === 國立臺灣大學 === 電機工程學研究所 === 70 === A class af context free grammars which we call Extended LL(k) grammars or ELL(k) grammars is proposed in this dissertation. As extended from the class of LL(k) grammars, an ELL(k) grammar may have productions uith common prefixes.
A neuf top-down deterministic parsing algorithm which we call the ELL(k) parser is also presented. An ELL(K) parser is very similar to an LR(k) parser. It consists of two parts, a driver routine and a parsing table. The driver routine is the same for all ELL(k) parsers; only the parsing table changes from one parser to another. The parsing table is composed of the states of ail parsing steps. There are two important informations associated with each states, one is the action to be taken on the input string, and the other is the state to be transfered after the action has been taken.
The states in the ELL(k) parsing table, are constructed by scanning each symbol in the right hand side Of the productions from start symbol top-downly. Besides the actions "shift", "reduce", "error", and "accept" which an LR(k) parser has, an Extended LL(k) parser has an extra action "refer" mhich transfers the parsing step to the starting state of a nonterminal symbol. With this special action, the most commonly used recursive descent parsers are included as special cases.
The main contributions of this work are the followings:
(1) A class of contaxt free grammars mhich we call Extended LL(k) or ELL(k) grammars is defined. This class has been shown to properly contain the LL(k) grammars.
(2) We propose a general top-down deterministic parsing algorithm witn uhich a parser can be generated automatically if productions of a grammar are given.
(3) The ELL(k) parsers provide a data driven programming style which is different from the subroutine-supported recursive descent parsers Besides, unlike recursive descent parsers, the ELL(k) parsers can be implemented by any programming language with or without the recursive capability.
(4) Since left recursive and left factoring are not required in an ELL(k) parser, the design of a grammar becomes easier and more natural.
|