AToyama / toy_compiler

0 stars 0 forks source link

v2.4 #8

Closed lucassa3 closed 5 years ago

lucassa3 commented 5 years ago

Versão testada: v2.4.2

Status: Erro

Seu programa apresentou defeito(s) com as seguinte(s) entrada(s): test1.vbs

Sub test()
    Dim a as integer
    a = 5
    print a
End Sub

Sub main()
    ' hello world
    Call test()
End Sub

test2.vbs

Sub test(a as integer)
    print a
End Sub

Sub main()
    ' hello world
    Dim top as integer
    top = 5
    Call test(top)
End Sub

test4.vbs

Sub check(n as integer)
    dim tres as integer
    dim cinco as integer
    dim flag as boolean

    tres = (n - (n / 3 * 3))
    cinco = (n - (n / 5 * 5))
    flag = True

    if (tres = 0) and (cinco = 0) then
        print 00001111
        flag = False
    end if

    if (tres = 0) and (flag = True) then
        print 0000
        flag = False
    end if

    if (cinco = 0) and (flag = True) then
        print 1111
    end if
End Sub

Sub fizzBuzz()
    ' adaptado da sabrina
    Dim n as integer

    n = input

    while n > 0
        Call check(n)
        n = n - 1     
    wend
End Sub

Sub main()
    Call fizzBuzz()
end sub

Comentários:

Corrija os erros de código/EBNF/DS apontados nesta issue.

Abraços!

AToyama commented 5 years ago

corrigido. O problema foi uma confusão minha de sintaxe, eu tinha pensado que pra chamar o sub era igual a function, sem o call.