Reduced & Modified Instruction Set Wrapper for C and C++

This R&D project intends to address / remedy:
1: The availability of unsafe functions in C/C++
2: Certain overly complex Functionalities in C/C++


Project Goals :

1: This project thus intends to derive a subset of C and C++ (initially catering enthusiasts, hobbyists, students and novices) AND allow a safe coding platform, where unsafe functions (intrinsic to the language), are filtered out / not allowed to go through into compilation stage. The Wrapper that will be developed under this project, will thus filter out all such "flagged" functionalities.

(Thus for example, all string manipulation functions which are know to be potentially unsafe will be excluded.)

2: Many novices/ new developers, finds the C/C++ memory pointer syntax overly cryptic and convoluted. For example we have Pointers, Pointers to Pointers,  References etc. etc. Thus for example when one gets into scenarios the such of, double indirections (and beyond), many finds it overly convoluted.

Thus to simplify the memory access synthax, a Set of more intuitive keywords will be introduced. 
For example (Mem&Of), (&Of-->), (Val@-->)

Which when translated into English:
Keyword English Translation
 (Mem&Of)  Memory Address Of
 (&Of-->)  Address Of Memory Pointer/ Location
 (Val@-->)  Value At Memory Pointer/ Location

Thus the new keywords would hopefully assist, specially a novice user to C/C++ get a better intuitive meaning of what the variables holds, what the operators does / return etc.

A modified notation to more clearly denote/ distinguish, elements / variable that can grow dynamically at run time AND those that are fixed in length (aka length / size defined/ set at compile time), will be introduced.

Thus for example the three dots in the following:
 CADAssembly[SubComponent ...]
 CADSubComponent[Element ...]
would represent dynamic arrays that can grow / shrink at runtime (aka. SubComponents and Elements can be added /removed at run time, and thus the array/ container can grow/ shrink in size, when the user adds / removes components from the CAD drawing / diagram).

Whereas in the following; ChessBoard, represents an Array that will not grow/ shrink in size during run time.
const int ROWS = 8:
const int COLUMNS = 8;
ChessBoard[ROWS][COLUMNS];

Likewise notations will be defined to more clearly denote, pointers to dynamic arrays etc.

A GUI component will be introduced to view / inspect dynamic and memory elements in a visual manner. For example the double star notation used in the argv element, is not immediately clear to a novice. Thus this GUI component will assist to visualize, the double indirection to the command line arguments.

3: The Wrapper will next Convert the above "more Intuitive Synthax", into the Native C/C++ Synthax and call the appropriate compiler to compile the Converted code.

4: This revised language synthax should have sufficient functionality/ depth, to call (for example) standard OS APIs, as well as industry standard libraries (ex: OpenGL, OpenCL, OpenCV etc.)

5: The Wrapper GUI, would check for violations of the Set of Reduced Instruction Set Rules, and provide / issue appropriate errors and warnings... (and only proceed onto submission to compilation, only once the identified errors/ faults have been fixed).

6: The possibility of developing "a common industry standard", to define Library and API Function Call pre/post requisites, will be looked into. Thus for example, if a given library function requires the caller to free some resources after calling the said function, such would be clearly mentioned in the said function's header, via a standardized notation. Thus with this approach, either the pre-compiler or the synthax checker would have sufficient information to do validation checks as to whether the program has carried out the requisite pre/ post conditions.

For example if a function GETRESOURCEHANDLE requires the caller to free the aquired RESOURCE HANDLE, before calling the function a second time, such will be documented inside the said function's header. Or if a function is not thread safe, such could be stated / specified inside it's header. Thus either at pre-compilation or during the synthax checking stages such validation checks, could be carried out and appropriate errors detected.

Thus this stage of the project will focus on developing a standardized notation to describe such pre/post conditions.

Note: This project, would in most likelyhood be of an Academic Persuit, (the such of a GNU Open Source Project).

At stage 1 (initial stage) a new compiler will NOT be developed, but instead a Wrapper will be developed over the existing C/C++ compiler(s) (ex : gcc). This Wrapper will thus filter out content that is allowed to pass through, to the compilation stage and convert the keywords of the Simplified Instruction Set C/C++, into their native C/C++ via Lookup Translation Tables. At this stage of the project, the Syntax and Keywords of this new simplified C/C++ language will be finalised.

In the subsequent (second stage), the existing gcc source code would be upgraded/ modified, to compile this new/ modified C/C++ language.

Comments

Popular posts from this blog

The DONX Framework &
The Dimensional Closure Principle :
A Counter-Cantorian Approach to Infinite Sets via Eℕ

A New Perspective on Infinity via a 2D Hilbert Hotel

Testing Feasibility of FTL Data Communication via Quantum Entanglement