Compiler Namespace Mapping for Shared Variable Conflict Prevention
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing technologies fail to prevent conflicts between variable names and unintentional overwriting of data when multiple programs share variables.
Innovation Solution
A compiler device and method that define a shared variable referenceable by multiple user programs, using an identifier acquisition part, shared variable name generation part, conversion part, and address determination part to generate a shared variable name, convert the program into machine language, and determine and embed the address of the shared variable.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If multiple user programs share variable names for data exchange, then data communication between programs is enabled, but variable name conflicts and unintentional data overwriting occur
Solution Approach 1:
The patent segments the variable name into two distinct parts: a program identifier (obtained from the object code) and the original variable name. This segmentation creates a hierarchical naming structure where each shared variable is uniquely identified by the combination of program ID and variable name, preventing conflicts between programs while maintaining data communication capability
Solution Approach 2:
The patent introduces an intermediary mechanism (the program identifier) that mediates between multiple programs accessing shared variables. This intermediary element acts as a namespace separator, allowing programs to share data while maintaining distinct identities, thus preventing unintentional overwriting
2Ease of operation
If variable names are used as keys for data storage and exchange, then data access between programs is simplified, but name conflicts cause incorrect data retrieval
Solution Approach 1:
The variable identifier is segmented into program ID and variable name components, allowing the system to maintain simple variable name access within a program while ensuring accurate cross-program data retrieval through the combined identifier
3Ease of manufacture
If the same variable name is used across multiple programs, then code reusability and simplicity are improved, but unintentional overwriting of shared variables occurs
Solution Approach 1:
By segmenting the variable identifier into program ID and variable name, the patent allows programs to use simple variable names in their code while the compiler automatically manages the full unique identifier, thus maintaining code simplicity and reusability while preventing overwriting through unique identification
Data Source
Figure 1
Figure 2
Figure 3
AI summary
The objective of the present invention is to prevent a conflict between variable names and unintended overwriting of data when a plurality of programs that define shared variables exist. A compiler device (12) comprises: an identifier acquisition unit (121a) for acquiring an identifier of a first user program; a shared variable name generation unit (121b) for generating a shared variable name that includes a variable name of a shared variable and the identifier; a conversion unit (121c) for converting the first user program to machine language; and an address determination unit (122a) for determining an address of the shared variable. The address determination unit (122a) associates the shared variable name and the address of the shared variable with each other and embeds these in the first user program that has been converted to machine language.