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):
'''
S : Dimensional action_7 equals EA action_8
@ -707,9 +706,14 @@ def p_action_15(p):
if (peek(typesStack) is not 'bool'):
raise Exception("Cannot use .not. with non boolean")
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) +
' ' + str(operand1) + '\n')
' ' + str(temp) + '\n')
quadrupletIndex += 1
def p_action_16(p):

View file

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

View file

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