You are here:

C++/Compiler Design.

Advertisement


Question
QUESTION: Dear Vijayan

http://en.wikipedia.org/wiki/Compiler
http://www.webopedia.com/TERM/C/compiler.html
http://whatis.techtarget.com/definition/compiler
http://www.personal.kent.edu/~rmuhamma/Compilers/compiler.html
http://www.cse.iitd.ernet.in/~sak/courses/cdp/slides.pdf
http://elvis.rowan.edu/~bergmann/books/c_cpp/Text/C_CppEd.pdf
http://www.cs.usfca.edu/~galles/compilerdesign/cimplementation.pdf
http://e-maxx.ru/bookz/files/mogensen.pdf
http://www.kau.edu.sa/Files/830/Files/60762_basics_of_compiler_design.pdf
http://kroker.emporia.edu/courses/2005/cs350s05/holub/docs.pdf

What would be the Best Approach for a Software Engineer to Design
a New Compiler after C#,VB.NET,Java ?

Can reading Books on Compiler Design, C, C++, C#, Java, Object Oriented Programming and Mastering those subjects assist a Software Engineer to Design a New Compiler after C#, VB.NET and Java ?

Awaiting your reply,

Thanks & Regards,
Prashant S Akerkar

ANSWER: Reading books on Compiler design and mastering those subjects is a basic requirement. The basic literature covers parsing techniques, lexical analysis, abstract syntax trees, tree writing and the like. These are quite well understood and can be automated to a large extent by using appropriate tools.

Writing a professional grade compiler involves a bunch of things over and above these; the most important ones being generating expressive, easy to understand diagnostic messages, and code optimization both at the front-end (pseudo code) and back-end (machine code). These are not covered except very skimpily in the basic text books.

Here are a few more references:
http://www.amazon.com/Building-Optimizing-Compiler-Bob-Morgan/dp/155558179X
http://www.amazon.com/Engineering-Compiler-Second-Edition-Cooper/dp/012088478X
http://www.amazon.com/Optimizing-Compilers-Modern-Architectures-Dependence-based
http://www.amazon.com/Advanced-Compiler-Design-Implementation-Muchnick/dp/155860

For state of the art techniques, one has to look at articles in technical journals -IEEE Xplore, CACM and the like.

Note: I missed the question earlier; hence this late reply.  

---------- FOLLOW-UP ----------

QUESTION: Dear Vijayan

Thank you.

Designing a New Programming Language after C,C++,C#,VB.Net,Java is to write a Compiler for the New Programming Language. We Know 'C' is a Modular Programming Language. C++, Java, VB.Net are Object Oriented Programming Languages.

If we Create a Table heading Programming Languages with six columns headings each for C, C++, C#, VB.NET, Java and "New" Programming Language and added records to the Table which states data types, declaring variables and constants, operators, programming style viz top down or bottom up, keywords, array declaration, structure declaration, function declaration, class declaration, pointer declaration, exception handling features, portability, Constructor, Destructor, Expressions viz if, if else, elseif, Looping syntax - for,while,do while etc, Platform independence  etc

The "New" Sixth Column records will be updated with new features of the New Programming Language.

This could be a Useful reference for designing and constructing a new compiler for the New Programming Language ?

The New Programming Language will have the features of C++, C#, JAVA,VB.NET but also will have additional new features which are not currently available in the current recent versions of C++, C#, Java, VB.Net. For example : New Data Types, New Keywords, New Operators - Taking help of Scientific Calculator for adding all functions and operators, New Symbols, Type safe/Non Type safe, Garbage collection methods, Database  handling mechanism, Exception Handling, XML Handling etc

The new compiler should be designed allowing end users to write robust code i.e. different applications viz desktop,client/server,web,mobile etc, run/execute faster in memory, code optimization features, Work on different hardware etc.

Most Importantly, The New Programming Language / Compiler designed has to be Universally Accepted as the Standards Programming Languages as designed and developed by the Greats Dennis Ritchie - 'C', Dr Stroustrup - C++, James Gosling - Java.

C Source Code Extension -> .c
C++ Source Code " " -> .cpp
VB.net Source Code " " -> .vb
C# Source Code " "-> .cs
Java Source Code " " -> .java

Will the above method/approach help us to build a new compiler after java,vb.net,C# ?

Awaiting your reply,

Thanks & Regards,
Prashant S Akerkar

Answer
I think a successful programming language is designed with a clear target domain in mind. Every widely used programming language today has a clear niche of sorts.

To take C++ as an example:

C++ excels in resource and performance constrained programming - jet engine controls, high-speed traffic enforcement systems, oil refineries pipeline, laser printer, high performance video games. In domains where strict, prioritized control over resources and execution paths are essential, where we need code that not only runs fast, but runs faster than those of competitors, C++ just has no equal.

The other, perhaps larger, C++ niche is building large infrastructural software. Several examples of these are listed here: http://www.stroustrup.com/applications.html


On the other hand, the D programming language http://dlang.org/index.html supports almost all the features that C++ supports, and added a bunch of extra features that are indigenous to imperative languages like Java or Scala and functional languages like lisp or Haskell. It was actively developed and promoted by a major compiler vendor - Digital Mars. But despite a fair amount of resources being invested in its development, over a number of years, adoption is negligible - it is never going to be widely used.  

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


vijayan

Expertise

my primary areas of interest are generic and template metaprogramming, STL, algorithms, design patterns and c++11. i would not answer questions about gui and web programming.

Experience

about 15 years or so

Education/Credentials
post graduate engineer

©2016 About.com. All rights reserved.