Skip to main content

Creating a New Programming Language and Compiler

Recently I have been looking into a special need to create my own programming language. I have also studied the history of different languages and success and issues they are struggling and stuck with.

Here is my personal point of view on this:

Creating a Purely new Programming Language

The best available language is C\C++ for a cross platform development with different compilers and debuggers. If you are thinking of creating a remarkable new language, HOLD ON,
         1- You need to create a compile to target X86, X64, and ARM etc
         2- Compiler shall work on Windows, Linux and MAC etc...
         3- You need to revisit the entire history of programming language in this case and you have to port all that stuff
         4- You Need IDE, compiler
         5- Debugger
         6- UI components on different machines .... and on on on, so on

You can see the history, C# and D language were created almost the same time (1999-2000). C# have an unmatched success.

A new Programming Language Based on Another Language:
So, If you plan to create a new language, keep these things in mind:

1- If the language you create, and source code is translated in to C\C++ and then is compiled with C\C++ compiler, then no issues at all... You are good to go. You can integrate all previously developed source code and api... You will get a good success

2- Translate you code into any other language say (for example say java) that closely matches the new language. Then use the same compiler(Java Compile) to compile the source code.
In this case you inherit all the limitations by default.

3- Create a language that generates MSIL (Microsoft Intermediate Language) which is .NET IL. This way you can have you own syntax and style and stuff... and Compile in to .NET.

      a- You can use the previously built .NET components.
      b- Your components can be used in .NET.
      c- You can access the C\C++ and COM as well using P-Invokes and COM interoperability

! This will work on Windows and in Limited way I guess on Linux with Mono.NET.


4- If the new language you creates; compile directly (instead of translating into C\C++, .NET or any other language) and you provide a good support for interoperability with System, hardware, and interoperability with C\C++ (dll). Then you are just ok... THIS is where I believe D language is.
But still along way to debuggers, cross platform compilation, Threading issues, a history still to walk through...

You have any feedback on these lines ... Please let me know.

Comments

Popular posts from this blog

Culture Information and Localization in .NET

Namespace: System.Globalization CultureInfo Class:                 It provides information like the Format of numbers and dates, Culture’s Calendar, Culture’s language and sublanguage (if applicable), Country and region of the culture. The Basic use of CultureInfo class is shown here: • How string Comparisons are performed • How Number Comparison & Formats are performed • Date Comparison and Formats. • How resources are retrieved and used. Cultures are grouped into three categories: Invariant Culture : It’s Culture Insensitive. It can be used to build some trial application. It can be also used to build an application with hard-coded expiry date that ignores cultures. But using it for every comparison will be incorrect and inappropriate. Neutral Culture : English(en), Frensh(fr), and Spanish(sp). A neutral culture is related to language but it’s not related to specific regi...

Concept of App Domain in .Net

Creating Application Domains: Application domain is just like process, provides separate memory space, and isolates from other code. But it’s quite light weight. It also provides the following advantages: 1-       Reliability : If a domain crashes, it can be unloaded. Hence doesn’t affect the other assemblies. 2-       Efficiency : Loading all assemblies in one domain can be cumbersome and can make the process heavy but Appdomains are efficient in this manner. Important properties of AppDomain: ApplicationIdentity , ApplicationTrust , BaseDirectory , CurrentDomain , DomainManager , DomainDirectory , Evidence , FriendlyName , ID , RelativeSearchPath , SetupInformation , ShadowCopyFiles . Important methods of AppDomain: ApplyPolicy , CreateCOMInstanceFrom , CreateDomain , CreateInstance (Assembly). To create an AppDomain: AppDomain adomain = AppDomain.CreateDomain(“D”); To execute an assembly:...

Asynchronous Execution in ASP.NET

Asynchronous Execution: Two ways either implement IHTTPAsyncHandler interface or in ASP.NET 2.0 set <%@ Page Async=”true” %>. The second option implements IHTTPAsyncHandler interface automatically for the page when parsed or compiled. AddOnPreRenderCompleteAsync ( new BeginEventHandler(BeginTask), new EndEventHandler(EndTask)); AddOnPreRenderCompleteAsync() shoud be called in Page_load. The BeginEventHandler and EndEventHandler are delegates defined as follows: IAsyncResult BeginEventHandler( object sender, EventArgs e, AsyncCallback cb, object state) void EndEventHandler( IAsyncResult ar) AsyncProcess starts and completes between PreRender and PreRenderComplete. Other way to perform Async Task is using AsyncPageTask structure. It also allows multiple tasks to execute simultaneously. void Page_Load (object sender, EventArgs e) { PageAsyncTask task = new PageAsyncTask( new BeginEventHandler(BeginTask), new EndEventH...