titan-lang / titan

The Titan programming language

Home Page:http://titan-lang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Titan Compiler doesn't run (titan-compiler.location module not found)

Jictyvoo opened this issue · comments

Problem

I installed Titan with luarocks for Lua 5.3
But everytime I want to tun compiler, with any file or without a file, appear a error message saying that:

Error

/usr/bin/lua5.3: /usr/local/share/lua/5.3/titan-compiler/checker.lua:3: module 'titan-compiler.location' not found:No LuaRocks module found for titan-compiler.location
no field package.preload['titan-compiler.location']
no file '/usr/local/share/lua/5.3/titan-compiler/location.lua'
no file '/usr/local/share/lua/5.3/titan-compiler/location/init.lua'
no file '/usr/local/lib/lua/5.3/titan-compiler/location.lua'
no file '/usr/local/lib/lua/5.3/titan-compiler/location/init.lua'
no file '/usr/share/lua/5.3/titan-compiler/location.lua'
no file '/usr/share/lua/5.3/titan-compiler/location/init.lua'
no file './titan-compiler/location.lua'
no file './titan-compiler/location/init.lua'
no file '/home/jictyvoo/.luarocks/share/lua/5.3/titan-compiler/location.lua'
no file '/home/jictyvoo/.luarocks/share/lua/5.3/titan-compiler/location/init.lua'
no file '/usr/local/lib/lua/5.3/titan-compiler/location.so'
no file '/usr/lib/x86_64-linux-gnu/lua/5.3/titan-compiler/location.so'
no file '/usr/lib/lua/5.3/titan-compiler/location.so'
no file '/usr/local/lib/lua/5.3/loadall.so'
no file './titan-compiler/location.so'
no file '/home/jictyvoo/.luarocks/lib/lua/5.3/titan-compiler/location.so'
no file '/usr/local/lib/lua/5.3/titan-compiler.so'
no file '/usr/lib/x86_64-linux-gnu/lua/5.3/titan-compiler.so'
no file '/usr/lib/lua/5.3/titan-compiler.so'
no file '/usr/local/lib/lua/5.3/loadall.so'
no file './titan-compiler.so'
no file '/home/jictyvoo/.luarocks/lib/lua/5.3/titan-compiler.so'
stack traceback:
[C]: in function 'require'
/usr/local/share/lua/5.3/titan-compiler/checker.lua:3: in main chunk
[C]: in function 'require'
/usr/local/lib/luarocks/rocks-5.3/titan/dev-1/bin/titanc:5: in main chunk
[C]: in ?

Ask

So, how can I make titanc work?

Sorry, the rockspec was missing that file, I am merging a hotfix for that.

While the PR with the fix does not get reviewed and merged you can see the changes at #246 and apply them to your local copy

Hi, thanks for fixing that, but now have other problem. I tried to compile a file containing that

 function divmod(a: integer, b: integer): (integer, integer)
    return a // b, a % b
end

local x, y = divmod(13, 2) -- ok
local x, _ = divmod(13, 2) -- ok

function just_div(a: integer, b: integer): integer
    return (divmod(a, b)) -- ok, arity of divmod is adjusted to 1
end 

but when I execute

titanc test.titan
in same directory that saved the file, titan prints many errors, so I tried to do the same thing that you when make the hotfix. And now doesn't show more require errors, I have pulled here #247

but, when I tried to run

titanc examples.sdl_demo -lSDL2

I get this error:

/usr/bin/lua5.3: /usr/local/share/lua/5.3/titan-compiler/coder.lua:2512: bad argument #1 to 'ipairs' (table expected, got nil)
stack traceback:
	[C]: in function 'ipairs'
	/usr/local/share/lua/5.3/titan-compiler/coder.lua:2512: in upvalue 'import_module'
	/usr/local/share/lua/5.3/titan-compiler/coder.lua:2802: in function 'titan-compiler.coder.generate'
	/usr/local/share/lua/5.3/titan-compiler/driver.lua:154: in function 'titan-compiler.driver.compile'
	/usr/local/share/lua/5.3/titan-compiler/driver.lua:133: in function 'titan-compiler.driver.compile_module'
	/usr/local/lib/luarocks/rocks-5.3/titan/dev-1/bin/titanc:57: in main chunk
	[C]: in ?

Obviously it should fail in that way because of that, and I will look into fixing the error message, but there is a sdl_quit.titan module missing in the examples folder that sdl_example.titan is trying to import. @hishamhm, could you check that in?

Sure! the file is here: #249