With Implementing a Custom Lang Succinctly Author | Syncfusion Blogs
Detailed Blog page Skeleton loader

The following is a short interview with Succinctly series author Vassili Kaplan, whose latest book, Implementing a Custom Language Succinctly, was published recently. You can download the book here.

Implementing a Custom Language Succinctly

What should people know about the subject of your book? Why is it important?

If you know how a compiler works, you start programming differently and more efficiently. There are a few ways of implementing the same algorithm, but usually they are not equivalent and one of them will do its job more efficiently than another.

For instance, in C++ the prefix operator ++x is usually more efficient than the postfix one x++, when x is not a primitive type.

In CSCS, “for (element : array)” loop is more efficient than “for (i = 0; i < size(array); ++i)” for accessing all elements of an array.

The good thing about a custom language is precisely that it’s custom—you can easily change basic language features and their implementation. For instance, you can fine-tune the performance of “for (i = 0; i < size(array); ++i)” loop if this is the loop you want to use the most. You can add new operators and new programming rules, so you can start having even more fun when programming!

When did you first become interested in this subject?

A few years ago, I wrote a custom algorithm to parse a mathematical expression, Split-And-Merge. When I was publishing an article describing this algorithm in MSDN Magazine, I was asked by the editor to add a sentence on how this algorithm can be used in real life. So I added this sentence:

 “With small adjustments you can also create your own C# compiler for your new scripting language”

(in https://msdn.microsoft.com/magazine/mt573716)

 Only after the article was published, I started thinking: “And how do I actually do that?”

As a result, I published another article in MSDN (https://msdn.microsoft.com/magazine/mt632273) and this is how CSCS, Customizable Scripting in C#, was born.