Skip to content

A small interpreter written in C/C++ that translates a minimal version of Lua (called "LiLua" for "Light Lua") into an intermediate form to be interpreted.

License

Notifications You must be signed in to change notification settings

mtfuller/lilua-interpreter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LiLua Interpreter

A small interpreter written in C/C++ and Java that can translate a minimal version of Lua (called "LiLua" for "Light Lua") into an intermediate form to then be interpreted by an interpretive engine.

Overview

This README file gives a rough overview of the LiLua interpreter. A brief description of LiLua is discussed in the next section. An quick example of the usage of the LiLua compiler and interpreter is presented in later sections. Repository can be found at the GitHub Repo.

What is LiLua?

LiLua, or "Light Lua," is a small subset of the Lua programming language. Here are the major differences:

Single-character, Non-case-sensitive Identifiers

-- This statement...
a = 5

-- ...is the same as this statement...
A = 5

-- Incorrect Identifiers...
ab = 2
count = 8

Only One Supported Data Type: Integer

-- Supported...
a = 5
b = 6
c = 2

-- Unsupported...
a = 5.6
b = false
c = "hello"

All Executable Code is Placed within a Function Declaration

-- Correct...
function f()
    a = 2
    b = 3
    c = a + b
    print(c)
end

-- Incorrect...
a = 5
b = 2 * a
function f()
    c = 7
    print(c)
end
print(b)

LiLua Compiler

The LiLua compiler is a small application written in C/C++ that takes in a Lua file, and produces an intermediate form. The intermediate form is then translated into a type of "byte code", which is then placed into a .lil file.

your-directory
|-- my-program.lua
liluac -c "<PATH>/your-directory/my-program.lua"
your-directory
|-- my-program.lil
|-- my-program.lua

LiLua Interpreter

The LiLua Interpreter takes in a .lil file, and then the interpreter reads the input from the file and performs corresponding actions.

your-directory
|-- my-program.lil
|-- my-program.lua
java -jar lilua.jar "<PATH>/your-directory/my-program.lil"

About

A small interpreter written in C/C++ that translates a minimal version of Lua (called "LiLua" for "Light Lua") into an intermediate form to be interpreted.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published