A Semantic Based Approach To Solve a Set of Non-LL(1) Convert To LL(1) Syntax Problems

Autor: Wei-Wu Lee, 李維武
Rok vydání: 2000
Druh dokumentu: 學位論文 ; thesis
Popis: 88
To compile a program correctly, syntax-analysis and semantic-processing are two indispensable steps. Two types of parsing approaches, LL(1) (top-down) and LR(1) (bottom-up), dominate the fields. To determine which one is the better is sometimes very difficult. It is commonly accepted that a LL approach is quite a good choice. Sometimes, a non-LL construct may be an obstacle. In this case, the overloading technique and various grammar transformation techniques may be useful. For example, some C compilers use overloading to handle various types of non-LL(1) expressions. This overloading technique easily resolves the difficulties of the various types of expressions being non-LL(1). However, the remaining task to overload the various (different) types of expressions is monstrously terrible, and sometime even impossible to resolve. However, there are language constructs that can not be or at least very difficult and very inefficient to be handled by these techniques. In order to finish the compiling, a more powerful LR parsing is of course possible. But if the LL is still preferred, then it is necessary to invent a new technique, either grammatically or semantically or both, to solve the non-LL problem. In this paper, instead of using the conventional overloading approach, we proposes a new semantic technique to handle these non-LL language constructs, and use a proposed LL parser to implement the details of using the technique. The authors present the approach affirmatively. We mentioned briefly that our approach is to invent pseudo terminals in the programming language to be compiled. I think that it is worthwhile to solve a set of problem by using a new technique (our pseudo-terminal technique) paying a little price instead of using the conventional technique (overloading technique) paying a monstrous price.
Databáze: Networked Digital Library of Theses & Dissertations