#lighzy-interpreter - An Interpreter for My Own Language in C++

2 messages · Page 1 of 1 (latest)

tawdry tundra
#

Introduction

This is an interpreter for my homemade programming language Lighzy. Lighzy is a dynamic, strongly typed and interpreted language. I created the project 2 months ago to improve my programming skills. Now I have completed most of the features. I am considering to support for object-oriented. It is really difficult to implement.

Usage

The following shows the basic usage of Lighzy:

let a = 2    // Immutable variables
var b = 3    // Mutable variables
b = 12

// Function
let say = fun(str)
{
    println(str)
}
say("Hello world!")

// Selection sort
let sort = fun(array)
{
    var i = 0
    while (i < len(array) - 1)
    {
        var j = i + 1
        while (j < len(array))
        {
            if (array[i] > array[j])
            {
                array[i] += array[j]
                array[j] = array[i] - array[j]
                array[i] -= array[j]
            }
            ++j
        }
        ++i
    }

    return array
}

let nums = [32, 63, -12, 16, -21, 85, 12, 9, 11]
let sorted = sort(nums)

Feedback welcom!
Project URL: https://github.com/QtLittleXu/lighzy-interpreter

stone light
#

@tawdry tundra What would it be best used for?