victorlga/lua-compiler

Problemas na v2.3.0

Closed this issue · 0 comments

victorlga/compiler
teste1: falha
input do teste:


local x_1
x_1 = read()

print(x_1)

if (x_1 > 1 and not not not(x_1 < 1)) or x_1 == 3 then
	x_1 = 2
end 


local x = 3+6/3   *  2 -+-  +  2*4/2 + 0/1 -((6+ ((4)))/(2)) -- Teste -- Teste 2
local y_1 = 3
y_1 = y_1 + x_1
local z__
z__ = x + y_1

if x_1 == 2 then
	x_1 = 2
end

if x_1 == 3 then
	x_1 = 2
else
	x_1 = 3
end

x_1 = 0
while x_1 < 1 or x == 2 do
	print(x_1)
	x_1 = x_1 + 1
end 



-- Saida final
print(x_1)
print(x)
print(z__+1)

-- All bool and operations
local y = 2
local z
z = (y == 2)
print(y+z)
print(y-z)
print(y*z)
print(y/z)
print(y == z)
print(y < z)
print(y > z)

-- All str operations 
local a 
local b

x_1 = 1 
y = 1 
z = 2
a = "abc"
b = "def"
print(a..b)
print(a..x_1)
print(x_1..a)
print(y..z)
print(a..(x_1==1))
print(a == a)
print(a < b)
print(a > b)


stdin do teste:
3
0
output esperado:
3
0
1
6
12
3
1
2
2
0
0
1
abcdef
abc1
1abc
12
abc1
1
1
0

output recebido:

(3, "INT")

Mas algo saiu no stderror(que não deveria):
Traceback (most recent call last):
File "main.py", line 15, in
parser.run(code).evaluate(symbol_table)
File "/home/ubuntu/LogCompTester/Compilers/src/victorlga/compiler/semantic.py", line 83, in evaluate
child.evaluate(symbol_table)
File "/home/ubuntu/LogCompTester/Compilers/src/victorlga/compiler/semantic.py", line 63, in evaluate
value = self.children[1].evaluate(symbol_table)
File "/home/ubuntu/LogCompTester/Compilers/src/victorlga/compiler/semantic.py", line 88, in evaluate
eval_children_0 = self.children[0].evaluate(symbol_table)
File "/home/ubuntu/LogCompTester/Compilers/src/victorlga/compiler/semantic.py", line 88, in evaluate
eval_children_0 = self.children[0].evaluate(symbol_table)
File "/home/ubuntu/LogCompTester/Compilers/src/victorlga/compiler/semantic.py", line 89, in evaluate
eval_children_1 = self.children[1].evaluate(symbol_table)
File "/home/ubuntu/LogCompTester/Compilers/src/victorlga/compiler/semantic.py", line 88, in evaluate
eval_children_0 = self.children[0].evaluate(symbol_table)
File "/home/ubuntu/LogCompTester/Compilers/src/victorlga/compiler/semantic.py", line 88, in evaluate
eval_children_0 = self.children[0].evaluate(symbol_table)
File "/home/ubuntu/LogCompTester/Compilers/src/victorlga/compiler/semantic.py", line 134, in evaluate
return self.children[0].evaluate(symbol_table), "INT"
File "/home/ubuntu/LogCompTester/Compilers/src/victorlga/compiler/semantic.py", line 136, in evaluate
return -self.children[0].evaluate(symbol_table), "INT"
TypeError: bad operand type for unary -: "tuple"