Programming Language with Extensions using a Strict Meta-Model
Abstract
Systems and methods for extending a programming language with a set of extensions using a strict meta-model are disclosed. Embodiments provide a set of interfaces that allow a schema to be synthesized. Syntax is introduced into an existing programming language to allow the construction of schematized data objects. A schema processor module translates a schema representation into new keywords. A document generator module receives the set of keywords and produces output in a selected form. When code comprising the keyword extensions is parsed, data structure nodes represent keyword actions as a set of functions and implements those function calls with the original meta-data. A keyword definition comprises a name and an action to be taken at parse time and an action to be taken at runtime. The default action at parse time is to inject a function call into the code. The default action at runtime is to call the function.
Claims
exact text as granted — not AI-modifiedWhat is claimed is:
1 . A computer-implemented method, comprising:
based on a specific schema having at least one user-defined keyword extension, translating a user-defined keyword extension, using a schema processor, into keyword definitions for a parser, wherein the translating further comprises generating dynamic keyword data structures detailing metadata of the user-defined keyword extension, and one or more keyword actions for performing the user-defined keyword extension; creating, by the parser, an intermediate representation of source code having a plurality of nodes, wherein each command node associated with the user-defined keyword extension is overloaded to contain: (i) information pointing to a dynamic keyword data structure, and (ii) additional keywords defined in a child scope of the command node; providing the intermediate representation of the source code to a document generator; and generating output code based on the intermediate representation of the source code, by the document generator, wherein the generating uses a set of one or more calls to the one or more keyword actions for the command nodes associated with the user-defined keyword extension.
2 . The method of claim 1 , further comprising:
based on input from a user, translating a generic schema into the specific schema based on a meta-model for a programming language, wherein the programming language has a constrained number of keywords defined for the parser that are extended to incorporate the at least one user-defined keyword extension and the meta-model defines the format and limits of the types of user-defined keyword extensions; and receiving the source code for the programming language at the parser, wherein the source code comprises the at least one user-defined keyword extension to the programming language, and the user-defined keyword extension is based on the specific schema.
3 . The method of claim 1 , further comprising:
translating a schema representation using the meta-model into new keywords by the schema processor.
4 . The method of claim 1 , wherein the document generator is an independent module that produces output in a desired format.
5 . The method of claim 1 , wherein the meta-model includes a first action to be taken at parse time, wherein the first action comprises creating, at parse time, a call to a routine having a keyword name.
6 . The method of claim 5 , wherein the meta-model includes a second action to be taken at runtime, wherein the second action further comprises invoking the one or more calls at runtime.
7 . A memory device having stored thereon computer-executable instructions that, upon execution by a processor of a computing system, configure the computer system to:
based on a specific schema having at least one user-defined keyword extension, translate a user-defined keyword extension, using a schema processor, into keyword definitions for a parser, wherein the translating further comprises generating dynamic keyword data structures detailing metadata of the user-defined keyword extension, and one or more keyword actions for performing the user-defined keyword extension; creating, by the parser, a data structure representative of source code, the representative data structure having a plurality of nodes, wherein each command node associated with the user-defined keyword extension is overloaded to contain: (i) information pointing to a dynamic keyword data structure, and (ii) additional keywords defined in a child scope of the command node; providing the representative data structure to a document generator as an intermediate representation of the source code; and generating output code based on the representative data structure, by the document generator, wherein the generating uses a set of one or more calls to the one or more keyword actions for the command nodes associated with the user-defined keyword extension.
8 . The memory device of claim 7 , further comprising:
based on input from a user, translate a generic schema into the specific schema based on a meta-model for a programming language, wherein the programming language has a constrained number of keywords defined for a parser that are extended to incorporate the at least one user-defined keyword extension and the meta-model defines the format and limits of the types of user-defined keyword extensions; receive source code for the programming language at the parser, wherein the source code comprises the at least one user-defined keyword extension to the programming language, and the user-defined keyword extension is based on the specific schema.
9 . The memory device of claim 7 , wherein the document generator is an output module for generating output code using the representative data structure.
10 . The memory device of claim 9 , further comprising:
select the output module based upon a user-designated format for the output code.
11 . The memory device of claim 7 , wherein the computer-executable instructions, upon execution by the processor further configure the computer system to:
check types defined in instances of the at least one user-defined keyword extension at parse-time; and map the given user-defined keyword extension to a command or statement in the programming language to implement a keyword behavior at runtime.
12 . A computer system, comprising:
a processor; and a memory coupled to the processor, the memory having program instructions stored thereon that, upon execution by the processor, configure the computer system to:
based on input from a user, translate a generic schema into a specific schema based on a meta-model for a programming language, wherein the programming language has a constrained number of keywords defined for a parser that are extended to incorporate user-defined keyword extensions and the meta-model defines the format and limits of the types of user-defined keyword extensions;
receive source code for the programming language at the parser, wherein the source code comprises a user-defined keyword extension to the programming language, and the user-defined keyword extension is based on the specific schema; based on the specific schema, translate the user-defined keyword extension, using a schema processor, into keyword definitions for the parser, wherein the translating further comprises generating dynamic keyword data structures associated with the user-defined keyword detailing metadata of the user-defined keyword extension, and one or more keyword actions for performing the user-defined keyword extension; creating, by the parser, a data structure representative of the source code, wherein each command node of the representative data structure associated with the user-defined keyword extension is overloaded to contain: (i) information pointing to the dynamic keyword data structure, and (ii) additional keywords defined in a child scope of the command node; providing the representative data structure to a document generator as an intermediate representation of the source code; and generating output code based on the representative data structure, by the document generator, wherein the generating uses a set of one or more calls to the one or more keyword actions for the command nodes associated with the user-defined keyword extension.
13 . The computer system of claim 12 , wherein hierarchical data representations comprise schematized data in a constrained format.
14 . The computer system of claim 12 , wherein the program instructions, upon execution by the processor, further configure the computer system to transform the output code to a desired format.
15 . The computer system of claim 12 , wherein the program instructions, upon execution by the processor, further configure the computer system to provide feedback to the user, the feedback identifying valid parameters for a specific instance of the user-defined keyword extension.Join the waitlist — get patent alerts
Track US2018136914A1 — get alerts on status changes and closely related new filings.
We store only your email — no account needed. See our privacy policy.