Change not operand to save the result in temp variable

This commit is contained in:
Mariano Uvalle 2019-04-25 04:11:50 -05:00
parent 94146e3185
commit 3bb50c40e1
3 changed files with 16 additions and 16 deletions

View file

@ -276,7 +276,6 @@ def p_B(p):
| |
''' '''
def p_S(p): def p_S(p):
''' '''
S : Dimensional action_7 equals EA action_8 S : Dimensional action_7 equals EA action_8
@ -707,9 +706,14 @@ def p_action_15(p):
if (peek(typesStack) is not 'bool'): if (peek(typesStack) is not 'bool'):
raise Exception("Cannot use .not. with non boolean") raise Exception("Cannot use .not. with non boolean")
global quadrupletIndex global quadrupletIndex
operand1 = peek(operandsStack) # It is not necessary to pop the types stack since the result will also
# be bool.
operand1 = operandsStack.pop()
temp = avail.pop(0)
operandsStack.append(temp)
resultQuadruplets.append('.not. ' + str(operand1) + resultQuadruplets.append('.not. ' + str(operand1) +
' ' + str(operand1) + '\n') ' ' + str(temp) + '\n')
quadrupletIndex += 1
def p_action_16(p): def p_action_16(p):

View file

@ -1,8 +1,6 @@
program test program test
integer :: b integer :: b
integer [10] :: a if (.not. 2 > 3 .or. 5 < 4) then
real :: c b = 2
do b = 0, 9 then end if
a(b) = b
end do
end program end program

View file

@ -1,8 +1,6 @@
= 0 $50 > 2 3 $0
<= $50 9 $0 < 5 4 $1
gotoF $0 9 .or. $0 $1 $2
+ 51 $50 $49 .not. $2 $0
= $50 *49 gotoF $0 7
+ $50 1 $1 = 2 $50
= $1 $50
goto 2