Regular Expressions with Semantic Rules and Their Application to Data Structure Directed Programs
暂无分享,去创建一个
Summary Most input data have structures that can be defined by regular expressions, and it is often necessary to develop programs that process these input data not only syntactically but also semantically. One formal method of developing such programs is to use attribute grammars, that is, context-free grammars augmented with semantic rules. Context-free grammars, however, are often inferior to regular expressions as tools for representing data structures intuitively, and systems based on attribute grammars are rather complex. This paper proposes regular expressions with semantic rules , which can be used as tools for expressing the syntax and semantics of input data, and a method of generating programs for processing these input data. First, regular expressions with semantic rules will be defined as regular expressions intermixed with semantic statements. Then, an algorithm will be given for translating a regular expression with semantic rules to a nondeterministic finite automaton with semantic actions (NFAS), and another algorithm for translating an NFAS to a deterministic finite automaton with semantic actions (DFAS). Finally, our semantic rules and translation algorithms will be expanded so that the proposed method can be applied to programs that process data defined in terms of regular expressions with semantic rules, that is, to data-structure-directed programs.