-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest1b.src
More file actions
47 lines (42 loc) · 1.16 KB
/
test1b.src
File metadata and controls
47 lines (42 loc) · 1.16 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
//leaving off end of program period. is it correct? officially no, but should we compile and simply issue a warning? i leave that up to you.
PROGRAM grant IS
global variable JAKE : integer;
global variable ryan : integer[3];
global variable zach : integer;
variable tmp : integer;
procedure if_proc : integer()
variable i : integer;
procedure dummy: float()
// this should just hide the i of the outter environment
variable i: float;
variable tst : bool;
begin
i := 4.5;
tst := putString("passed");
return (0);
end procedure;
begin
i := for_proc(); // this should fail; we do not allow forward references.
if(true) then jake := jake + 1;
else zach := zach + RYAN[2];
end if;
return (0);
end procedure;
procedure for_proc : integer()
variable x : bool;
procedure dummy2 : float()
begin
i := 3; // this should fail; we do not allow forward references
return 1;
end procedure;
global variable i : integer;
begin
for(i := 0; i < zach)
ryan[1] := zach + i;
end for;
return (0);
end procedure;
begin
tmp := if_proc();
tmp := for_proc();
end program