higherGlobal.wacc 273 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# function uses a global function

# Output:
# 12

# Exit:
# 0

# Program:

begin
  int g(int a) is
    return a
  end

  int h(int b) is
    return b + 10
  end

  int{int} f(int{int} d) is
21
    return h
22
23
24
25
26
27
  end

  int{int} x = call f(g);
  int y = call x(2);
  println y
end