Customizable Compiler Attributes for Code Checking
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing compilers lack the ability to access and utilize additional information provided by programmers about programming constructs, which can be valuable for code checking and optimization, due to limitations in the programming language syntax and potential changes to the compiled code.
Innovation Solution
The introduction of customizable compiler attributes and logic within the source code allows programmers to provide additional information to the compiler, enabling code checking and optimization at compile time without altering the compiled code, using built-in compiler functions to evaluate and process these attributes.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Loss of information
If the compiler uses only standard programming language syntax to access information about programming constructs, then the compiled code remains unchanged and compatible, but the compiler cannot access additional valuable information provided by programmers
Solution Approach 1:
The patent introduces compiler attributes as an intermediary mechanism that allows programmers to provide additional information about programming constructs without changing the compiled code. These attributes serve as a mediator between the programmer's intent and the compiler's analysis capabilities, enabling the compiler to access valuable information (such as target types of descriptors) that would otherwise be unavailable through standard syntax alone.
2Reliability
If the compiler performs code checking and optimization using additional programmer-provided information, then code quality and optimization improve, but the complexity of the compiler increases
Solution Approach 1:
The patent applies preliminary action by having programmers pre-attach compiler attributes to programming constructs during code writing. This preliminary provision of information allows the compiler to perform more accurate code checking and optimization without needing to implement complex analysis mechanisms, as the necessary information is already prepared and organized for the compiler to process.
3Loss of time
If the compiler evaluates programmer-provided information at compile time, then logic errors are detected early and optimization is improved, but the compiler requires additional processing capabilities
Solution Approach 1:
The patent implements self-service by enabling the compiler to automatically evaluate and process the programmer-provided attributes during compilation without requiring external tools or additional processing systems. The compiler uses built-in functions to analyze the attributes, detect logic errors, and perform optimizations, making the system self-sufficient and reducing the need for complex external infrastructure.
Data Source
AI summary
Disclosed herein is technology to use customized compiler attributes to check source code. An example method may include: accessing, by a processing device executing a compiler, a source code that comprises a compiler attribute associated with a programming construct, wherein the compiler attribute is defined in the source code; executing, by the processing device, a function of the compiler to check the programming construct at a location in the source code, wherein the function checks the programming construct by evaluating the compiler attribute associated with the programming construct; determining, by the processing device executing the compiler, whether to generate a message indicating a status of the check; and generating, by the processing device executing the compiler, object code based on the source code that comprises the compiler attribute.


