Image by Garry Tailor via https://images.app.goo.gl/zAysEkk5BBWebt9g6

This article discusses the good, the bad, and the ugly sides of Go programming language.

The Good

Go is simple. That has been one of the prime design goals of Go as well. It also makes it easy to learn and adopt the language very quickly. Some of the areas that Go is much more simple and light-weighted are:

  • A minimal set of language constructs.
  • Simple project and module structures.
  • Minimalistic visibility control (only public and package-private).
  • Easy to define types (structs).
  • Easy to write tests — no need for external testing frameworks.

Go programs being compiled down to machine code, and…


One of the nightmares of implementing a production-grade parser is having to deal with user errors and invalid codes. My previous article discusses the algorithms and some implementation details of a lexer and a parser. In this article, I will discuss how to handle syntax errors in a parser, and recover from them to produce a resilient parse tree.

Syntax Errors

A syntax error is a case where an unexpected token is reached, or in other words, the next token does not match the defined grammar. In different languages, there can be many different syntax errors. …


In my previous article (Writing a Parser — Getting Started), I discussed the basic architecture of a parser, some terminologies, and when to go for a handwritten parser and when to not. I also discussed some high-level details of different components of a parser and their requirements.

In this article, I will discuss in detail about each of these components, and the algorithms to be followed including some implementation details. This is more of a continuation of my previous article, so I would strongly recommend reading that before going through the rest of this article.

Character Reader / Input Reader

The main purpose of having…


This article discusses a simple approach to implement a handwritten parser from scratch and some fundamentals associated with it. This focuses more on explaining the practical aspects of the implementation rather than the formal definitions of parsers.

Introduction

A parser is the very first thing that comes to our mind when we speak of compiler-development/compiler-construction. Rightly so, a parser plays a key role in a compiler architecture and can also be considered as the entry-point to a compiler. Before we get into the details of how to write a parser, let's see what parsing actually means.

Parsing essentially means converting a…


Ballerina 1.1.0 was released in January 2020, and the runtime (jBallerina) is running on top of the JVM. Thus ballerina provides seamless interaction with Java, which allows developers to leverage features of Java through ballerina. This article will explain in detail how you can simply create java objects and invoke java methods through ballerina without much of a hassle.

I will create a simple stack in ballerina with the use of java stack implementation. Here I have assumed the familiarity with basic ballerina syntaxes and semantics. …


There are several libraries currently available for java bytecode manipulation such as ASM, ApacheBCEL, Javassist and etc. In this article I will discuss about the ASM library, what is it for, how to use it, and how you could resolve some common issues that you may encounter. This will be a series of articles, and the first one will focus on introducing the library and its features.

What is ASM?

ASM is a framework that allows manipulating and generating JVM bytecode. It allows modifying existing classes, programmatically generating new classes and analyzing existing classes, directly in their bytecode (binary) format. …


What is stacking?

Stacking is one of the three widely used ensemble methods in Machine Learning and its applications. The overall idea of stacking is to train several models, usually with different algorithm types (aka base-learners), on the train data, and then rather than picking the best model, all the models are aggregated/fronted using another model (meta learner), to make the final prediction. The inputs for the meta-learner is the prediction outputs of the base-learners.

Figure 1

How to Train?

Training a stacking model is a bit tricky, but is not as hard as it sounds. All it requires is some similar steps as k-fold cross-validation. First of…

Supun Setunga

Compiler Developer | Statistician | Machine Learning Enthusiast

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store