up: Table of contents | prev | next: Minilang Syntax

1.1 Introduction

We begin defining a very small C-like language for the purpose of explaining the operation of the SoulNG lexer and parser generator tools. We will call that language Minilang. It is just expressive enough so that we can write functions operating with integers.

Here's the greatest common divisor algorithm written in Minilang:

        int gcd(int a, int b)
        {
            while (b != 0)
            {
                a = a % b;
                int t = a;
                a = b;
                b = t;
            }
            return a;
        }
    

The language will have integer and Boolean types, variables, parameters, literals and expressions. It will contain while loops, compound, conditional and return statements. It is possible to create variables, assign them values and evaluate expressions.

up: Table of contents | prev | next: Minilang Syntax