Extending program languages with source-program attribute tags
First Claim
Patent Images
1. A system for extending a programming language, comprising:
- a source program including at least one syntactically identifiable attribute tag embedded in a sequence of source-language statements;
a compiler for converting the source-language program into a different form, and, in response to encountering the attribute tag in the source program during conversion of the source program to the different form, for calling an attribute provider external to the compiler and associated with the attribute tag for modifying the operation of the compiler at a point in the source program remote from the point at which the attribute tag is embedded.
2 Assignments
0 Petitions
Accused Products
Abstract
Attribute tags embedded in the statements of a source program system extend a programming language. A compiler for the program includes an interface to detect the attribute tags and to call one of a number of attribute-provider programs external to the compiler. The provider programs modify the operation of the compiler, for example by injecting additional statements or other code into the program at one or more predetermined points remote from the attribute tag. The compiler interface lists the names of the attributes and locations of their associated provider programs.
103 Citations
73 Claims
-
1. A system for extending a programming language, comprising:
-
a source program including at least one syntactically identifiable attribute tag embedded in a sequence of source-language statements;
a compiler for converting the source-language program into a different form, and, in response to encountering the attribute tag in the source program during conversion of the source program to the different form, for calling an attribute provider external to the compiler and associated with the attribute tag for modifying the operation of the compiler at a point in the source program remote from the point at which the attribute tag is embedded. - View Dependent Claims (2, 3, 4, 5, 6)
-
-
7. A system for extending a programming language in a customizable manner, comprising:
-
a compiler for receiving a source-language input program including a plurality of statements and a plurality of different embedded attribute tags syntactically identifiable from the statements, and for converting the input program to a different form;
a plurality of attribute providers external to the compiler and to each other, and respectively associated with different ones of the tags for modifying the input program during conversion to the other form, the compiler calling one of the attribute providers when encountering its associated attribute tag in the input program for performing an operation in respect of the program while converting the source program to the different form. - View Dependent Claims (8, 9, 10, 11, 12, 13)
a list of the attribute tags;
a list of identifiers for locating respective ones of the attribute providers in the list of tags.
-
-
10. The system of claim 7 where the different form of the input is a parse tree.
-
11. The system of claim 10 where the compiler includes a back end for producing object code from the parse tree.
-
12. The system of claim 7 where the input program is modified in the compiler.
-
13. The system of claim 7 further including a log for recording modifications made to the input program by the attribute providers.
-
14. A compiler for extending a programming language, comprising:
-
a front end for receiving a source program having statements in the language and also having a plurality of attribute tags syntactically identifiable from the statements embedded in the statements;
an interface for calling a plurality of attribute providers external to the compiler in response to respective ones of the tags and for receiving outputs from the attribute providers;
a converter for performing operations upon the program in response to the outputs from the attribute providers while converting the program to a different form. - View Dependent Claims (15, 16)
-
-
17. An attribute provider for extending a programming language, comprising:
-
an input module for receiving a call from an external compiler converting a source program in the programming language into a different form, when the compiler encounters a syntactically identifiable attribute tag in the source program while converting the source program to the different form;
at least one operation module for performing an operation in response to the attribute tag;
an output module for modifying the source program in accordance with the call, at a point remote from that at which the attribute tag occurs. - View Dependent Claims (18, 19, 20, 21, 22, 23)
-
-
24. A computer-implemented method for constructing a computer program in an extensible programming language, comprising:
-
writing the program as a sequence of source-code statements and attribute tags syntactically identifiable from the statements;
compiling the program to a different form in a compiler;
encountering one of the attribute tags at a certain location while compiling the program;
selecting one of a plurality of independently replaceable attribute providers external to the compiler in response to the one attribute tag;
modifying the program in the compiler by the attribute provider. - View Dependent Claims (25, 26, 27, 28)
-
-
29. A computer-implemented method for constructing a program in an extensible programming language, comprising:
-
receiving an input program having a sequence of statements and a plurality of different syntactically identifiable attribute tags;
converting the input program to a different form in a compiler;
while converting the program, encountering one of the different attribute tags;
selecting one of a plurality of different and mutually independent attribute providers external to the compiler in response to which of the attribute tags was encountered;
modifying the conversion of the input program by the selected attribute provider at a location remote from the location of the respective attribute tags. - View Dependent Claims (30, 31, 32, 33, 34)
matching the encountered tag with a list of available attribute tags;
reading a location of the matched attribute tag;
calling the attribute provider at the location.
-
-
34. A computer-readable medium containing instructions and data for carrying out the method of claim 29.
-
35. A method of constructing a source program, comprising:
-
composing a sequence of statements in a predetermined source language;
embedding in a plurality of the statements a plurality of different attribute tags syntactically identifiable from the statements for causing a compiler to inject additional statements into the program during compilation of the program to another form, the additional statements being at a location in the program remote from the location of the respective attribute tags. - View Dependent Claims (36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47)
-
-
48. A computer-readable medium containing program instructions for carrying out a method for constructing a program in an extensible programming language, comprising:
-
receiving an input program having a sequence of statements and a plurality of different syntactically identifiable attribute tags;
converting the input program to a different form in a compiler;
while converting the program, encountering one of the different attribute tags;
selecting one of a plurality of different and mutually independent attribute providers external to the compiler in response to which of the attribute tags was encountered;
modifying the conversion of the input program by the selected attribute provider at a location remote from the location of the respective attribute tags. - View Dependent Claims (49)
-
-
50. An attribute provider adapted to cooperate with a compiler that receives source code including one or more attribute tags, wherein the compiler creates one or more internal data structures representative of the source code and creates executable code based on the internal data structures, and wherein the compiler includes logic which detects said attribute tags, the attribute provider comprising:
-
a first method exposed by the attribute provider to the compiler, wherein the compiler invokes said first method in response to detection of a first one of the attribute tags;
an input module which receives an attribute from said first one of said attribute tags when said first method is invoked, and which parses said attribute to derive one or more values from said attribute;
an operation module which determines an action to be taken based on said attribute; and
an output module which communicates said action to the compiler. - View Dependent Claims (51, 52, 53, 54, 55)
-
-
56. A system for using a compiler to create executable code, wherein the compiler receives source code and creates executable code based on the source code, the system comprising:
a first attribute provider which includes a first method that modifies the source code, wherein said attribute provider exposes said first method such that said first method is callable by the compiler, wherein the source code includes one or more attribute tags prior to being received by the compiler, and wherein the compiler includes logic which detects said attribute tags and invokes said first method in response to detection of at least a first one of said attribute tags.
-
57. A method of supporting the use of attribute tags in a source program, the method comprising:
-
receiving, in an attribute provider, a first method call from a compiler which converts the source program to one or more internal data structures and uses said internal data structures to create executable code, said method call indicating the presence of a first one of the attribute tags in the source program; and
in response to said first method call, modifying at least one of said internal data structures. - View Dependent Claims (58, 59, 60, 61)
said attribute provider communicating a stream of bytes to said compiler indicative of a modification to be made, whereby said compiler alters said at least one of said internal data structures in accordance with said stream.
-
-
61. The method of claim 57, further comprising:
said attribute provider communicating information to said compiler by calling a second method exposed by said compiler.
-
62. A computer-readable medium having computer-executable instructions adapted to cooperate with a compiler that converts the source program to one or more internal data structures and uses said internal data structures to create executable code, the computer-executable instructions being adapted to perform a method comprising the acts of:
-
receiving a first method call from the compiler, said method call indicating the presence of a first one of the attribute tags in the source program; and
in response to said first method call, modifying at least one of said internal data structures.
-
-
63. A method of compilation that supports the use of attribute tags in a source program written in a programming language, the method comprising:
-
in a compiler, performing a lexical analysis of the source program;
during said lexical analysis, detecting the presence of a first one of the attribute tags in the source program, said first attribute tag not being part of the programming language; and
in response to said detecting act, calling a first method on a first attribute provider which is external to said compiler and communicatively coupled to said compiler. - View Dependent Claims (64, 65, 66)
determining, based on which of the attribute tags is detected, whether to call said first method on said first attribute provider or on a second attribute provider different from said first attribute provider, said second attribute provider being external to said compiler and communicatively coupled to said compiler.
-
-
65. The method of claim 63, wherein said first attribute provider comprises a library of methods dynamically linkable to said compiler, wherein said library includes said first method.
-
66. The method of claim 63, further comprising the act of said compiler exposing a second method to said first attribute provider, whereby said first attribute provider communicates with said compiler by calling said second method.
-
67. A method of supporting the extensibility of a pre-defined programming language, the programming language including a plurality of lexical tokens, the method comprising:
-
providing a compiler which;
(a) recognizes the lexical tokens;
(b) recognizes an attribute tag which is not one of the lexical tokens;
(c) calls a first method external to said compiler in response to recognition of said attribute tag; and
(d) converts source code written in the programming language into one or more internal data structures conforming to a pre-defined format;
publicizing an interface to said compiler, said interface including (a) a profile of said first method and (b) said pre-defined format; and
exposing said internal data structures whereby said internal data structures are manipulable by said first method. - View Dependent Claims (68, 69, 70, 71)
(e) creates executable code based on said one or more internal data structures.
-
-
69. The method of claim 67, wherein said compiler exposes a second method callable by an object external to said compiler, whereby said object communicates information to said compiler by calling said second method.
-
70. The method of claim 67, further comprising:
providing an attribute provider which implements said first method and which modifies at least one of said internal data structures when said first method is called.
-
71. The method of claim 70, wherein said attribute provider comprises a library of methods dynamically linkable to said compiler.
-
72. A computer-readable medium which stores components comprising:
-
a compiler that;
receives source code having one or more attribute tags;
creates one or more internal data structures based on the source code;
creates executable code based on said one or more internal data structures;
detects the presence of at least a first one of said attribute tags; and
invokes a method in response to detection of said first attribute tag; and
an attribute provider that;
receives a call to said method; and
in response to the call to said method, modifies at least a first one of said internal data structures. - View Dependent Claims (73)
determines to modify said first one of said internal data structures based on which of said attribute tags is detected by the compiler.
-
Specification