Comment Reading Compiler

By | March 26, 2015

Comment Reading Compiler is an idea proposed to increase the the program understandability by the compiler. Users can give his own inputs through statements to the Comment Reading Compiler.

We all have used compilers which usually have the functionality of removing comments. But if the compiler could somehow read comments and understand the program code, the process of debugging and validation required in the next phases could be greatly reduced. The syntax trees for source programming language statements as well as comments could be separately constructed. Then another routine could compare both the syntax trees to find out whether they remain the same or not. Then an Intermediate code and finally the Target code could be generated and optimized like any other ordinary compiler would carry out. The compiler would thus enhance the productivity of software developers and reduce the development and testing time needed to produce software. The future projects and features to be added to the compiler are also discussed. Compiler automatically generates the code without rewriting the program again.

INTRODUCTION

We have always encountered a compiler which rejects the comments. Compiler designers have always felt that comments are meaningful only to programmers but not to the compiler. The lexical analyses phase of a typical compiler ignores comments from the source file and sends only the identified tokens to the next phase of the compiler i.e. syntax analyzer. But in this process a lot of useful information is lost. Only the syntax tree relating to the source programming language statements is generated.

But we also know of techniques like decision trees and machine learning which can be used to process natural language statements. We use these decision trees and convert them to syntax trees and thus compare the trees.

Thus it is a combination of two types of different analyzers:

  1. Programming language statement analyzer (Context free grammar)
  2. Comment (Natural language)

ADVANTAGES FROM READING COMMENTS

Usually compilers of the present generation always ignore comment lines and take only the source language statements. But if the comments could also be analyzed by the compiler, it would further reduce the communication gap between the programmer and the compiler. The task to be done by a particular language expression of the programming language will be conveyed by the programmer in the form of comments, thus introducing strict compile time checks. This would drastically reduce the testing and validation time required for that particular program code, which is of great value to the software industry which faces stiff competition and tough delivery deadlines.

 

FUTURE WORK
With the improvements in existing natural language processing systems, the task of creating a syntax tree for natural language statements would become efficient. Even the requirements taken from clients could be fed as initial comments to compiler, thus helping it to analyze what the customer actually needs. Also a knowledge base would be created where templates of existing codes could be stored. Hence the next time a similar requirement arrives, the compiler automatically generates the code without rewriting the program again.

Please Share: Tweet about this on TwitterShare on FacebookShare on Google+Share on RedditPin on PinterestShare on LinkedInDigg thisShare on StumbleUponShare on TumblrBuffer this pageShare on VKEmail this to someone

Leave a Reply

Your email address will not be published. Required fields are marked *