Compiler with generic front end and dynamically loadable back ends
First Claim
1. An apparatus for compiling a source code file and producing variable target outputs therefrom, the apparatus comprising:
- a front end that accepts the source code file and produces therefrom an abstract syntax tree that represents the syntactic structure of the source code file, the abstract syntax tree having at least one abstract syntax tree node;
at least one back end that produces an associated back end tree from the abstract syntax tree, and further produces from the back end tree a target output, the back end tree having at least one back end tree node attached to an abstract syntax tree node; and
a generic back end that controls and sequences execution of the at least one back end to produce an associated back end tree from each back end, wherein each back end is independent of the generic back end and is dynamically loaded by the apparatus during execution.
0 Assignments
0 Petitions
Accused Products
Abstract
A system and method provides for variable target outputs from a compiler with only a single execution. The compiler includes a front end, a generic back end, and plurality of individual back ends that are dynamically loaded by the compiler during execution. The front end produces an abstract syntax tree which is then processed by the generic back end and the individual back ends to produce a number of back end trees, each adapted for a specific back end, and representative of the desired structure of the various target outputs, including target code files, or events. The generic back end traverses the abstract syntax tree, and on each node of the tree, invokes each back end that has a node of its back end tree attached thereto. The back end can then modify its own back end tree, and attach further back end nodes to other nodes of the abstract syntax tree. In turn the generic back end will invoke such added attached nodes, until all attached back end nodes on all the nodes of the abstract syntax tree have been processed. This results in completed back end trees for all of the back ends, requiring only a single pass of the front end to produce the abstract syntax tree. The individual back ends then process their respective back end trees to produce their target outputs. A look up operation is provided in the generic back end that returns one or more back end nodes in response to a request therefore specifying a node of the abstract syntax tree, and a family identification value of a back end node.
-
Citations
17 Claims
-
1. An apparatus for compiling a source code file and producing variable target outputs therefrom, the apparatus comprising:
-
a front end that accepts the source code file and produces therefrom an abstract syntax tree that represents the syntactic structure of the source code file, the abstract syntax tree having at least one abstract syntax tree node; at least one back end that produces an associated back end tree from the abstract syntax tree, and further produces from the back end tree a target output, the back end tree having at least one back end tree node attached to an abstract syntax tree node; and a generic back end that controls and sequences execution of the at least one back end to produce an associated back end tree from each back end, wherein each back end is independent of the generic back end and is dynamically loaded by the apparatus during execution. - View Dependent Claims (2, 3)
-
-
4. A method for compiling a source code file and producing variable target outputs therefrom, the method comprising the steps of:
-
receiving a source code file; executing a compiler having a front end and a generic back end; loading at least one back end to operate with the generic back end; creating an abstract syntax tree from the source code with the front end, the abstract syntax tree including a root node and at least one child node; generating, under the control of the generic back end, from each back end a back end tree associated with the back end, the back end tree having at least one back end tree node attached to an abstract syntax tree node; attaching to the root node of the abstract syntax tree a back end node of at least one back end tree; selecting nodes of the abstract syntax tree, and for each selected node, adding to selected back end trees zero or more back end nodes representing syntactic information derived from the abstract syntax tree; attaching selected back end nodes to selected nodes of the abstract syntax tree; and producing from each back end a target output. - View Dependent Claims (5, 6, 7, 8, 9)
-
-
10. A computer system for compiling a source code file and producing variable target outputs therefrom, the apparatus comprising:
-
a memory device that stores; an abstract syntax tree that represents the syntactic structure of the source code file and having at least one abstract syntax tree node; at least one back end tree associated with a back end and derived from the abstract syntax tree, each back end tree having at least one back end tree node attached to an abstract syntax tree node; at least one back end that produces from the abstract syntax tree a back end tree associated with the back end, and further produces from the back end tree a target output, each back end independent of a compiler, and dynamically loaded by the compiler during execution, each back end invoked by a generic back end in the selected order; the compiler comprising; a front end that accepts the source code file and produces therefrom the abstract syntax tree; a generic back end that coordinates construction of the at least one back end tree by invoking a back end associated with at least one back end tree node attached to an abstract syntax tree node in a selected order; and a processing device that executes the generic back end and the at least one back end to produce from the at least one back end at least one target output.
-
-
11. An apparatus for compiling a source code file and producing variable target outputs therefrom, the apparatus comprising:
-
a front end that accepts the source code file and produces therefrom an abstract syntax tree that represents the syntactic structure of the source code file, the abstract syntax tree having at least one abstract syntax tree node; at least one back end that produces an associated back end tree from the abstract syntax tree, and further produces from the back end tree a target output, the back end tree having at least one back end tree node attached to an abstract syntax tree node; and a generic back end that controls and sequences execution of the at least one back end to produce an associated back end tree from the at least one back end, wherein each back end is independent of the generic back end and is dynamically loaded by the apparatus during execution; and
wherein each back end further comprises;an add operation, invocable by the generic back end, that adds zero or more back end nodes to a back end tree. - View Dependent Claims (12, 13, 14, 15)
-
-
16. An apparatus for compiling a source code file and producing variable target outputs therefrom, the apparatus comprising:
-
a front end that accepts the source code file and produces therefrom an abstract syntax tree that represents the syntactic structure of the source code file, the abstract syntax tree having at least one abstract syntax tree node; at least one back end that produces an associated back end tree from the abstract syntax tree, and further produces from the back end tree a target output, the back end tree having at least one back end tree node attached to an abstract syntax tree node; and
,a generic back end that controls and sequences execution of the at least one back end to produce an associated back end tree from the at least one back end, wherein each back end is independent of the generic back end and is dynamically loaded by the apparatus during execution; and
each back end and each back end node associated with the back end has a family identification value, the generic back end further comprising;a look up operation that returns zero or more nodes from at least one back end tree having a family identification value and attached to a node of the abstract syntax tree in response to a request from a back end specifying the family identification value and the node of the abstract syntax tree.
-
-
17. A method for compiling a source code file and producing variable target outputs therefrom, comprising the steps of:
-
receiving a source code file; executing a compiler having a front end and a generic back end; loading at least one back end to operate with the generic back end; creating an abstract syntax tree from the source code file with the front end, the abstract syntax tree including a root node and at least one child node; generating, under the control of the generic back end, from each back end, a back end tree associated with the back end, the back end tree having at least one back end node attached to an abstract syntax tree node, each back end and back end node associated therewith having a family identification value; producing from each back end tree a target output; receiving a request specifying a family identification value and a node of the abstract syntax tree; and returning zero or more back end nodes from at least one back end tree having a same family identification value and attached to the specified node of the abstract syntax tree.
-
Specification