-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanother_test.py
More file actions
89 lines (78 loc) · 1.67 KB
/
another_test.py
File metadata and controls
89 lines (78 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
!--------------------------------------
! Programming Language: mathpy.py
! Orientation: numerical calculations
! Author: Sharif Nasser Kadamani
! ID: A00820367
! This a test code
!--------------------------------------
! This is a comment
! Below there is an example program written in mathpy
! It is supposed to read dimensions of two matrices y verify if it is possible to sum them up
program exampleMatrix:
integer :: a, b, c, d, e(a,b), f(c,d)
real :: unusedvar ! For illustration
! Unused subroutines for illustration only
subroutine abc()
a + b + c
end subroutine abc
subroutine cba()
c + (b + a)
end subroutine
! The real example code starts here
do
print *, "Escriba la dimension uno de la matriz uno"
read *, a
print *, "Escriba la dimension dos de la matriz uno"
read *, b
print *, "Escriba la dimension uno de la matriz dos"
read *, c
print *, "Escriba la dimension dos de la matriz dos"
read *, d
a = 0
b = 0
c = 0
d = 0
if (a == c ) then
if b == d then
do a = 0, c
do b = 0, d
e(a,b) = e(a,b) + f(a,b)
print *, e(a,b)
end do
end do
end if
exit
end if
if (b == d) then
if a == c then
do a = 0, c
do b = 0, d
e(a,b) = e(a,b) + f(a,b)
print *, e(a,b)
end do
end do
end if
end if
end do
end program exampleMatrix
def p_variables(p):
'''
variables : variables COMMA ID matrix
| ID matrix
'''
if (len(p) > 3):
symbolTable.update({p[3]: var_type[0]})
else:
symbolTable.update({p[1]: var_type[0]})
def p_matrix(p):
'''
matrix : LPAREN index RPAREN
| empty
'''
pass
def p_index(p):
'''
index : arithmetic COMMA arithmetic
| arithmetic
'''
pass