AToyama / toy_compiler

0 stars 0 forks source link

v3.0 #7

Closed lucassa3 closed 5 years ago

lucassa3 commented 5 years ago

Versão testada: v3.0.3

Status: erro

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

Sub main()
    ' hello world
    Dim a as integer
    a = 5
    print a
End Sub

test2.vbs

Sub main()
    Dim tb as boolean
    Dim ti as integer

    tb = TRUE
    ti = 10

    if tb then
        print ti + 10
    end if
End Sub

test3.vbs

Sub main()
    Dim teste_bool as boolean
    Dim teste_int as integer
    teste_bool = True
    teste_int = 10

    if teste_bool then
        print teste_int + 10
    end if

    while (teste_int > 0) and teste_bool
        print teste_int
        teste_int = teste_int - 1
    wend

    teste_int = input
    print teste_int

End Sub

test4.vbs

Sub main()
    ' adaptado da sabrina

    dim fizz as integer
    dim buzz as integer
    dim fizzbuzz as integer
    dim n as integer
    dim tres as integer
    dim cinco as integer
    dim flag as boolean

    n = INPUT
    fizz = 0000
    buzz = 1111
    fizzbuzz = 00001111
    flag = True

    while n > 0
        tres = (n - (n / 3 * 3))
        cinco = (n - (n / 5 * 5))

        print n

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

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

        if (cinco = 0) and (flag = True) then
            print buzz
            flag = False
        end if

        flag = True
        n = n - 1
    wend
end sub

test5.vbs

Sub main()
    ' bool ops
    Dim bt as boolean
    Dim bf as boolean
    bt = True
    bf = False

    print bf and bt
    print bf or bt
    print not(not(bf))
    print not((bt and bf) or bf)
end sub

fail5.vbs

Sub main()
    Dim a as integer
    a = 5 --2
    if a then 
        print 100
    end if
end sub

Comentários:

Corrija o que foi apontado nesta issue para a próxima release. Não se esqueça de manter a EBNF e o DS atualizados, eles são a documentação da linguagem de seu compilador.

Abraços!

AToyama commented 5 years ago

issue fix on release 3.0.1