Skip to content

Nymphium/llix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

llix - Lightweight Lua Interpreter eXtended

/ˈliɹ.ɪks/

concept

llix is Lua interpreter, added the try-catch syntax.

try
	if tonumber(io.read()) < 5 then
		throw()
	end
catch
	io.stderr:write "Error\n"
end

type annotation

You can annotate type of variable:

-- in comment, `T@ <varname> :: <type>`
local num = 3 -- T@ num :: number

-- yes, you fail
local notstr = 0 -- T@ notstr :: string

only allowed to annotate monomorphic type and can't do about functions' return value.

delimited continuation

local t = {1, 2, 3, 4, 5}
local x = delim
    for i = 1, #t do
        if t[i] > 3 then
            continue t[i]
        end
    end
end

print(x) -- prints `4' !!!

usage

$ llix
llix - Lightweight Lua Interpreter eXtended (MoonScript version 0.4.0 on Lua 5.3)

> try
>> if tonumber(io.read()) < 5 then
>> throw()
>> end
>> print "foo"
>> catch
>> io.stderr:write "Error\n"
>> end
3
Error
>

installation

$ luarocks install --local llix

or

$ git clone https://github.com/Nymphium/llix
$ cd llix
$ luarocks install --local make llix-build-1.rockspec

requirement

  • Lua

TODO

$ grep -E '\b(TODO)|(XXX)\b' *

License

MIT License