Method for compiling a source code

一种源代码、代码的技术,应用在用于编译源代码领域,能够解决不支持程序创建新规则或变换现有规则等问题

Active Publication Date: 2017-08-01
HUAWEI TECH CO LTD
View PDF5 Cites 2 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] However, known systems for describing rewriting rules do not support programs to create new rules or transform existing rules

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
  • Method for compiling a source code
  • Method for compiling a source code
  • Method for compiling a source code

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0030] figure 1 A method 100 for compiling source code into program code is shown, the method comprising providing 101 a schema diagram based on the source code, the schema diagram corresponding to an intermediate representation of the source code according to a rule set in a first programming language , wherein the rule set includes specific replacement rules indicating that a pattern graph is to be replaced by a corresponding replacement graph assigned to the pattern graph; replacing 103 the pattern graph with the replacement graph assigned to the pattern graph; and generating 105 program code based on the replacement graph.

[0031] Thus, writing rules without extra codes can be executed. Furthermore, extensions can be performed if an existing DSL has new rules. Rules can be further written in any language supported by the DSL framework. In addition, cross-DSL rules and rule testing can be supported.

[0032] According to some implementation forms, a hierarchical DSL fr...

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 relates to a method for compiling a source code to a program code, the method comprising: providing (101) a pattern graph based on the source code, the pattern graph corresponding to an intermediate representation of the source code according to a set of rules in a first programming language, wherein the set of rules comprises a specific replacement rule directing a pattern graph to be replaced by a corresponding replacement graph assigned to the pattern graph, replacing (103) the pattern graph by the replacement graph assigned to the pattern graph, and generating (105) the program code based on the replacement graph.

Description

technical field [0001] none Background technique [0002] Domain-Specific Languages ​​(Domain-Specific Languages, DSL) are programming languages ​​specific to a specific application domain. A possible framework for constructing a compiled DSL may include creating the DSL by the author, implementing the DSL, and using the DSL by the application developer to obtain the application. This allows clients of the DSL, such as application developers, to program at an extremely high level while producing optimized code. [0003] To generate and optimize a compiled program, program transformations can be used, which take the program's abstract syntax tree (AST) as input and produce another AST. A rewrite rule is a specific kind of such transformation that describes a pattern of tree fragments and transforms each fragment matching the pattern into an output fragment while keeping everything else in place. Rewriting rules are quite important for program optimization, and some DSLs ca...

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 Applications(China)
IPC IPC(8): G06F9/44G06F9/45
CPCG06F8/311G06F8/44G06F8/41
Inventor 亚历山大·弗拉基米罗维奇·斯莱萨连科阿列克谢·瓦西里耶维奇·罗曼诺夫张洪波
Owner HUAWEI TECH CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products