meevee98 / PNP

PNP is not Pseudocode
MIT License
0 stars 0 forks source link

Include the semantic of relational operations #13

Closed meevee98 closed 4 years ago

meevee98 commented 4 years ago

Closes #3

I needed to do some changes in the grammar because relational operations weren't allowed to boolean operands.

Thacryba commented 4 years ago

Hello there! Here I am back again with some reports... Happy New Year!

Tests
Equality 1. The result of the operation of Equality between booleans with value true, assigned into a boolean variable. Expected: It should be no semantic error. Result: The code was translated without semantic errors. 1. The result of the operation of Equality between booleans with value true and false, assigned into a boolean variable. Expected: It should be no semantic error. Result: The code was translated without semantic errors. 1. The result of the operation of Equality between booleans with value false, assigned into a boolean variable. Expected: It should be no semantic error. Result: The code was translated without semantic errors. 1. The result of the operation of Equality between booleans with value false and true, assigned into a boolean variable. Expected: It should be no semantic error. Result: The code was translated without semantic errors. 1. The result of the operation of Equality between integers, assigned into a boolean variable. Expected: It should be no semantic error. Result: The code was translated without semantic errors. 1. The result of the operation of Equality between characters, assigned into a boolean variable. Expected: It should be no semantic error. Result: The code was translated without semantic errors. 1. The result of the operation of Equality between rationals, assigned into a boolean variable. Expected: Error Type. Result: `line 8:17 mismatched input '=' expecting {'>', '<'}` 1. The result of the operation of Equality between strings, assigned into a boolean variable. Expected: Error Type. Result: `line 8:17 Operator '=' cannot be applied to 'String', 'String'` 1. The result of the operation of Equality between booleans with value true, assigned into a rational variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Rational and Boolean` 1. The result of the operation of Equality between booleans with value true, assigned into a integer variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Integer and Boolean` 1. The result of the operation of Equality between booleans with value true, assigned into a character variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Character and Boolean` 1. The result of the operation of Equality between booleans with value true, assigned into a string variable. Expected: Error Type. Result: `line 8:4 Incompatible types between String and Boolean` 1. The result of the operation of Equality between rationals, assigned into a boolean variable. Expected: Error Type. Result: `line 8:17 mismatched input '=' expecting {'>', '<'}` 1. The result of the operation of Equality between integers, assigned into a rational variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Rational and Boolean` 1. The result of the operation of Equality between integers, assigned into a integer variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Integer and Boolean` 1. The result of the operation of Equality between integers, assigned into a character variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Character and Boolean` 1. The result of the operation of Equality between integers, assigned into a string variable. Expected: Error Type. Result: `line 8:4 Incompatible types between String and Boolean` 1. The result of the operation of Equality between characters, assigned into a rational variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Rational and Boolean` 1. The result of the operation of Equality between characters, assigned into a integer variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Integer and Boolean` 1. The result of the operation of Equality between characters, assigned into a character variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Character and Boolean` 1. The result of the operation of Equality between characters, assigned into a string variable. Expected: Error Type. Result: `line 8:4 Incompatible types between String and Boolean`
Inequality 1. The result of the operation of Inequality between booleans with value true, assigned into a boolean variable. Expected: It should be no semantic error. Result: The code was translated without semantic errors. 1. The result of the operation of Inequality between booleans with value true and false, assigned into a boolean variable. Expected: It should be no semantic error. Result: The code was translated without semantic errors. 1. The result of the operation of Inequality between booleans with value false, assigned into a boolean variable. Expected: It should be no semantic error. Result: The code was translated without semantic errors. 1. The result of the operation of Inequality between booleans with value false and true, assigned into a boolean variable. Expected: It should be no semantic error. Result: The code was translated without semantic errors. 1. The result of the operation of Inequality between integers, assigned into a boolean variable. Expected: It should be no semantic error. Result: The code was translated without semantic errors. 1. The result of the operation of Inequality between characters, assigned into a boolean variable. Expected: It should be no semantic error. Result: The code was translated without semantic errors. 1. The result of the operation of Inequality between rationals, assigned into a boolean variable. Expected: Error Type. Result: `line 8:17 mismatched input '!=' expecting {'>', '<'}` 1. The result of the operation of Inequality between strings, assigned into a boolean variable. Expected: Error Type. Result: `line 8:17 Operator '!=' cannot be applied to 'String', 'String'` 1. The result of the operation of Inequality between booleans with value true, assigned into a rational variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Rational and Boolean` 1. The result of the operation of Inequality between booleans with value true, assigned into a integer variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Integer and Boolean` 1. The result of the operation of Inequality between booleans with value true, assigned into a character variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Character and Boolean` 1. The result of the operation of Inequality between booleans with value true, assigned into a string variable. Expected: Error Type. Result: `line 8:4 Incompatible types between String and Boolean` 1. The result of the operation of Inequality between rationals, assigned into a boolean variable. Expected: Error Type. Result: `line 8:17 mismatched input '!=' expecting {'>', '<'}` 1. The result of the operation of Inequality between integers, assigned into a rational variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Rational and Boolean` 1. The result of the operation of Inequality between integers, assigned into a integer variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Integer and Boolean` 1. The result of the operation of Inequality between integers, assigned into a character variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Character and Boolean` 1. The result of the operation of Inequality between integers, assigned into a string variable. Expected: Error Type. Result: `line 8:4 Incompatible types between String and Boolean` 1. The result of the operation of Inequality between characters, assigned into a rational variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Rational and Boolean` 1. The result of the operation of Inequality between characters, assigned into a integer variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Integer and Boolean` 1. The result of the operation of Inequality between characters, assigned into a character variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Character and Boolean` 1. The result of the operation of Inequality between characters, assigned into a string variable. Expected: Error Type. Result: `line 8:4 Incompatible types between String and Boolean`
Greater Then 1. The result of the operation of Greater Then between rationals, assigned into a boolean variable. Expected: It should be no semantic error. Result: The code was translated without semantic errors. 1. The result of the operation of Greater Then between integers, assigned into a boolean variable. Expected: It should be no semantic error. Result: The code was translated without semantic errors. 1. The result of the operation of Greater Then between characters, assigned into a boolean variable. Expected: It should be no semantic error. Result: The code was translated without semantic errors. 1. The result of the operation of Greater Then between booleans with value true, assigned into a boolean variable. Expected: Error Type. Result: `line 8:17 mismatched input '>' expecting {'=', '!='}` 1. The result of the operation of Greater Then between strings, assigned into a boolean variable. Expected: Error Type. Result: `line 8:17 Operator '>' cannot be applied to 'String', 'String'` 1. The result of the operation of Greater Then between rationals, assigned into a rational variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Rational and Boolean` 1. The result of the operation of Greater Then between rationals, assigned into a integer variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Integer and Boolean` 1. The result of the operation of Greater Then between rationals, assigned into a character variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Character and Boolean` 1. The result of the operation of Greater Then between rationals, assigned into a string variable. Expected: Error Type. Result: `line 8:4 Incompatible types between String and Boolean` 1. The result of the operation of Greater Then between integers, assigned into a rational variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Rational and Boolean` 1. The result of the operation of Greater Then between integers, assigned into a integer variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Integer and Boolean` 1. The result of the operation of Greater Then between integers, assigned into a character variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Character and Boolean` 1. The result of the operation of Greater Then between integers, assigned into a string variable. Expected: Error Type. Result: `line 8:4 Incompatible types between String and Boolean` 1. The result of the operation of Greater Then between characters, assigned into a rational variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Rational and Boolean` 1. The result of the operation of Greater Then between characters, assigned into a integer variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Integer and Boolean` 1. The result of the operation of Greater Then between characters, assigned into a character variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Character and Boolean` 1. The result of the operation of Greater Then between characters, assigned into a string variable. Expected: Error Type. Result: `line 8:4 Incompatible types between String and Boolean`
Greater Then or Equal 1. The result of the operation of Greater Then or Equal between integers, assigned into a boolean variable. Expected: It should be no semantic error. Result: The code was translated without semantic errors. 1. The result of the operation of Greater Then or Equal between characters, assigned into a boolean variable. Expected: It should be no semantic error. Result: The code was translated without semantic errors. 1. The result of the operation of Greater Then or Equal between booleans with value true, assigned into a boolean variable. Expected: Error Type. Result: `line 8:17 mismatched input '>=' expecting {'=', '!='}` 1. The result of the operation of Greater or Equal Then between strings, assigned into a boolean variable. Expected: Error Type. Result: `line 8:17 Operator '>=' cannot be applied to 'String', 'String'` 1. The result of the operation of Greater Then or Equal between rationals, assigned into a boolean variable. Expected: Error Type. Result: `line 8:4 Incompatible types between String and Boolean`. 1. The result of the operation of Greater Then or Equal between integers, assigned into a rational variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Rational and Boolean` 1. The result of the operation of Greater Then or Equal between integers, assigned into a integer variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Integer and Boolean` 1. The result of the operation of Greater Then or Equal between integers, assigned into a character variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Character and Boolean` 1. The result of the operation of Greater Then or Equal between integers, assigned into a string variable. Expected: Error Type. Result: `line 8:4 Incompatible types between String and Boolean` 1. The result of the operation of Greater Then or Equal between characters, assigned into a rational variable. Expected: Error Type. Result: `line 8:4 Incompatible types between String and Boolean` 1. The result of the operation of Greater Then or Equal between characters, assigned into a integer variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Integer and Boolean` 1. The result of the operation of Greater Then or Equal between characters, assigned into a character variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Character and Boolean` 1. The result of the operation of Greater Then or Equal between characters, assigned into a string variable. Expected: Error Type. Result: `line 8:4 Incompatible types between String and Boolean`
Less Then 1. The result of the operation of Less Then between rationals, assigned into a boolean variable. Expected: It should be no semantic error. Result: The code was translated without semantic errors. 1. The result of the operation of Less Then between integers, assigned into a boolean variable. Expected: It should be no semantic error. Result: The code was translated without semantic errors. 1. The result of the operation of Less Then between characters, assigned into a boolean variable. Expected: It should be no semantic error. Result: The code was translated without semantic errors. 1. The result of the operation of Less Then between booleans with value true, assigned into a boolean variable. Expected: Error Type. Result: `line 8:17 mismatched input '<' expecting {'=', '!='}` 1. The result of the operation of Less Then between strings, assigned into a boolean variable. Expected: Error Type. Result: `line 8:17 Operator '<' cannot be applied to 'String', 'String'` 1. The result of the operation of Less Then between rationals, assigned into a rational variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Rational and Boolean` 1. The result of the operation of Less Then between rationals, assigned into a integer variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Integer and Boolean` 1. The result of the operation of Less Then between rationals, assigned into a character variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Character and Boolean` 1. The result of the operation of Less Then between rationals, assigned into a string variable. Expected: Error Type. Result: `line 8:4 Incompatible types between String and Boolean` 1. The result of the operation of Less Then between integers, assigned into a rational variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Rational and Boolean` 1. The result of the operation of Less Then between integers, assigned into a integer variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Integer and Boolean` 1. The result of the operation of Less Then between integers, assigned into a character variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Character and Boolean` 1. The result of the operation of Less Then between integers, assigned into a string variable. Expected: Error Type. Result: `line 8:4 Incompatible types between String and Boolean` 1. The result of the operation of Less Then between characters, assigned into a rational variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Rational and Boolean` 1. The result of the operation of Less Then between characters, assigned into a integer variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Integer and Boolean` 1. The result of the operation of Less Then between characters, assigned into a character variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Character and Boolean` 1. The result of the operation of Less Then between characters, assigned into a string variable. Expected: Error Type. Result: `line 8:4 Incompatible types between String and Boolean`
Less Then or Equal 1. The result of the operation of Less Then or Equal between integers, assigned into a boolean variable. Expected: It should be no semantic error. Result: The code was translated without semantic errors. 1. The result of the operation of Less Then or Equal between characters, assigned into a boolean variable. Expected: It should be no semantic error. Result: The code was translated without semantic errors. 1. The result of the operation of Less Then or Equal between booleans with value true, assigned into a boolean variable. Expected: Error Type. Result: `line 8:17 mismatched input '<=' expecting {'=', '!='}` 1. The result of the operation of Less or Equal Then between strings, assigned into a boolean variable. Expected: Error Type. Result: `line 8:17 Operator '<=' cannot be applied to 'String', 'String'` 1. The result of the operation of Less Then or Equal between rationals, assigned into a boolean variable. Expected: Error Type. Result: `line 8:17 mismatched input '<=' expecting {'>', '<'}` 1. The result of the operation of Less Then or Equal between integers, assigned into a rational variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Rational and Boolean` 1. The result of the operation of Less Then or Equal between integers, assigned into a integer variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Integer and Boolean` 1. The result of the operation of Less Then or Equal between integers, assigned into a character variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Character and Boolean` 1. The result of the operation of Less Then or Equal between integers, assigned into a string variable. Expected: Error Type. Result: `line 8:4 Incompatible types between String and Boolean` 1. The result of the operation of Less Then or Equal between characters, assigned into a rational variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Rational and Boolean` 1. The result of the operation of Less Then or Equal between characters, assigned into a integer variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Integer and Boolean` 1. The result of the operation of Less Then or Equal between characters, assigned into a character variable. Expected: Error Type. Result: `line 8:4 Incompatible types between Character and Boolean` 1. The result of the operation of Less Then or Equal between characters, assigned into a string variable. Expected: Error Type. Result: `line 8:4 Incompatible types between String and Boolean`
Some variations of this code were used in the test: ``` procedimento principal inicio var1: booleano; var1 <- true; var2: booleano; var2 <- true; var3: booleano; var3 <- var1 = var2; fim ```