Skip to content

Implement semantic of the While statement#14

Open
meevee98 wants to merge 3 commits into
developmentfrom
when-statement
Open

Implement semantic of the While statement#14
meevee98 wants to merge 3 commits into
developmentfrom
when-statement

Conversation

@meevee98
Copy link
Copy Markdown
Owner

Closes #8
This pull request depends on #13 because of the unit tests. While it isn't merged, I'm setting this as a draft.

@meevee98 meevee98 self-assigned this Dec 20, 2019
@meevee98 meevee98 mentioned this pull request Dec 20, 2019
20 tasks
@meevee98 meevee98 marked this pull request as ready for review January 6, 2020 13:36
@meevee98 meevee98 requested a review from Thacryba January 6, 2020 13:36
@Thacryba
Copy link
Copy Markdown
Collaborator

Hello! Sorry by the lack of time...
I was making some tests with this PR and this is what I got: 👍

Tests
  1. The result of the operation Equality between integers inside the while condition.
    Expected: It should be no semantic error.
    Result: The code was translated without semantic errors.

  2. The result of the operation Inequality between integers inside the while condition.
    Expected: It should be no semantic error.
    Result: The code was translated without semantic errors.

  3. The result of the operation Greater Then between integers inside the while condition.
    Expected: It should be no semantic error.
    Result: The code was translated without semantic errors.

  4. The result of the operation Greater Then or Equal between integers inside the while condition.
    Expected: It should be no semantic error.
    Result: The code was translated without semantic errors.

  5. The result of the operation Less Then between integers inside the while condition.
    Expected: It should be no semantic error.
    Result: The code was translated without semantic errors.

  6. The result of the operation Less Then or Equal between integers inside the while condition.
    Expected: It should be no semantic error.
    Result: The code was translated without semantic errors.

  7. The result of the operation Equality between integer and character inside the while condition.
    Expected: Error Type.
    Result: line 7:19 Operator '=' cannot be applied to 'Integer', 'Character'

  8. The result of the operation sum between integers inside the while condition.
    Expected: Error Type.
    Result: line 7:25 no viable alternative at input 'var1+var2)' null

  9. The result of the operation subraction between integers inside the while condition.
    Expected: Error Type.
    Result: line 7:25 no viable alternative at input 'var1-var2)' null

  10. The result of the operation division between integers inside the while condition.
    Expected: Error Type.
    Result: line 7:27 no viable alternative at input 'var1divvar2)' null

  11. The result of the operation multiplication between integers inside the while condition.
    Expected: Error Type.
    Result: line 7:25 no viable alternative at input 'var1*var2)' null

  12. The result of the operation modulo between integers inside the while condition.
    Expected: Error Type.
    Result: null line 7:27 no viable alternative at input 'var1modvar2)'

  13. The result of the operation AND between booleans with value true inside the while condition.
    Expected: It should be no semantic error.
    Result: The code was translated without semantic errors.

  14. The result of the operation OR between booleans with value true inside the while condition.
    Expected: It should be no semantic error.
    Result: The code was translated without semantic errors.

  15. The result of the operation XOR between booleans with value true inside the while condition.
    Expected: It should be no semantic error.
    Result: The code was translated without semantic errors.

  16. The result of the operation NOT with a boolean with value true inside the while condition.
    Expected: It should be no semantic error.
    Result: The code was translated without semantic errors.

Some variations of this code were used in the test:

procedimento principal
inicio
    var1: inteiro;
    var1 <- 1;
    var2: inteiro;
    var2 <- 3;
    enquanto (var1 < var2) faca 
        var1 <- var1 + var2;
    fim
fim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants