Font Size: a A A

Based On DOM/AST Design Technology C Language Parser

Posted on:2012-01-09Degree:MasterType:Thesis
Country:ChinaCandidate:B C GuoFull Text:PDF
GTID:2178330335452453Subject:Computer Science and Technology
Abstract/Summary:PDF Full Text Request
Analysis C language statement is compiled C language source files and header files must first realize the process. How to correctly parse C language statement, on the back of the compilation work and the style of the source code is critical. Compiled in accordance with the principle of the method in the design process, this first stream of characters in C source code, from left to right symbolize characters one by one, resulting in one lexical unit (token), as the syntax analysis unit of analysis, This process is designed to process the lexical analyzer. Finally DOM /AST technology to deal with these lexical units into an Abstract Syntax Tree (AST), this process is the parsing process. That is the C language statement is divided into lexical analysis and syntax analysis levels.Document Object Model (DOM) is the HTML and XML documents in order to achieve the development of the API. It is the World Wide Web Consortium (W3C) and platform-independent way using the definition of a standard, based on hierarchical organization of nodes or a collection of pieces of information. The Abstract Syntax Tree (AST) is used to describe the source code written in a specific language or a simple abstract syntax structure. In order to give third parties access to C language files simple and fast interface, this combination of DOM and AST technology, innovation, put forward a DOM/AST technical concepts, combined with the compilation of some of the major theoretical principles, proposed and designed a generic C Language parser, the paper's main functions include:1) Introduced the concept of the parser, the parser in the compiler described in the position to put forward innovative DOM/AST technology concepts, but also introduced the symbol tables, lexical analysis and syntax analysis of the concept.2) In the lexical design, lexical analysis described in the lexical unit, the concept of patterns and morpheme analysis of a lexical analysis phase in the input buffer need to use technology and lexical recognition algorithms, including:recognition algorithm lexical unit, the algorithm to solve lexical errors and how to recognize the constant algorithm, recognition algorithm in this paper, the analysis also focused on AC algorithm that can quickly recognize a keyword.3) In the grammar design, first introduced the concept of grammar and syntax to eliminate the ambiguity of technology, and then briefly discussed the nature of the next C syntax errors and error recovery of the general strategy, and finally analyzed top-down and Bottom up parsing techniques. In top-down parsing, recursive descent focused, predictive analysis, and LL (1) syntax analysis, and in the bottom-up parsing, we first briefly introduces into-reduction analysis, and finally Analysis focused on how to build a LR (1) parser.
Keywords/Search Tags:DOM/AST Technology, C Language, Lexer Analyzer, Parser Analyzer
PDF Full Text Request
Related items