Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

An efficient program parsing method and system based on file dependencies

A program analysis and file technology, applied in the field of program analysis, can solve the problems of abstract syntax trees, difficult memory sharing, difficult application, slow detection speed, etc., and achieve the effect of reducing program analysis time, avoiding repeated analysis, and improving analysis efficiency

Active Publication Date: 2021-02-05
PEKING UNIV +1
View PDF4 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

Since defect detection first needs to know the grammatical structure of the program, if the abstract syntax tree cannot be parsed quickly, the entire detection speed will be slowed down accordingly
like figure 2 As shown, each source file is parsed into an abstract syntax tree (ie, AST) by a separate process; however, each source file may include header files that are included in different source files Contains and thus is parsed repeatedly throughout the parsing process
[0005] In the prior art, there has been research on the problem of repeated parsing of header files, but the current research only solves this problem in the field of compilation, and there is still a lack of technology to solve this problem in the field of static analysis; secondly, because the current research is optimized for compilation, However, each file is run through an independent process during compilation, so it is difficult to achieve memory sharing for the abstract syntax tree across files, and the existing compilation acceleration technology is difficult to apply in the scenario of full program analysis

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • An efficient program parsing method and system based on file dependencies
  • An efficient program parsing method and system based on file dependencies
  • An efficient program parsing method and system based on file dependencies

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0026] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are the Some, but not all, embodiments are invented. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.

[0027] image 3 A schematic flow chart of the program analysis method provided by the embodiment of the present invention, such as image 3As shown, it includes: S1, performing segmentation processing on the source file, and obtaining the corresponding preprocessing unit set; S2, performing the following processing on each preprocessing unit in the preprocessing unit s...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention provides an efficient program parsing method and system based on a file dependency relationship. The method comprises the following steps that: S1: carrying out segmentation processing on a source file, and obtaining a corresponding preprocessed unit set; and S2: executing the following processing on each preprocessed unit in the preprocessed unit set: if the type of the preprocessedunit is confirmed as a file inclusion instruction in a preprocessed instruction, extracting a header file in the preprocessed unit, linking the abstract syntax tree of the header file to the abstractsyntax tree of the source file if a confirmation result shows that the abstract syntax tree obtained through header file pre-parsing is in the presence, and executing S1 and S2 to parse the header file as the source file if the confirmation result shows that the abstract syntax tree obtained through header file pre-parsing is in the absence. By use of the method, whether the header file is parsedin advance or not is judged, the abstract syntax tree obtained by pre-parsing is linked to the abstract syntax tree of the source file, the repeated parsing of the same header file is avoided, and program parsing time is shortened.

Description

technical field [0001] The invention relates to the technical field of program analysis, in particular to an efficient program analysis method and system based on file dependencies. Background technique [0002] Parsing is the first step in program analysis, and the goal is to generate an abstract syntax tree (Abstract Syntax Tree, AST) from the program source code. An abstract syntax tree describes the hierarchy of a program, such as figure 1 As shown, it is an abstract syntax tree of a main function, and its abstract syntax tree specifically includes a root node (TranslationUnit) and a subtree about a function declaration (MethodDeclaration), where the function declaration contains a function return type (PrimitiveType ), the function name (SimpleName) and the function body (Block), the function body includes the return statement (ReturnStatement) and the number literal (NumberLiteral). A resolution unit corresponds to a source file. Since the function in this example is...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Patents(China)
IPC IPC(8): G06F8/41
CPCG06F8/427
Inventor 高庆马森张世琨张君福朱何龙
Owner PEKING UNIV
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products