summaryrefslogtreecommitdiff
path: root/prolog/problems/denotational_semantics/algol_if_3/en.py
blob: f4ae00ad25c34eb68f14c3240b2d5f2abad11001 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# coding=utf-8

id = 177
name = 'algol_if/3'
slug = 'interpreter for mini-algol with if-statement'

description = '''\
<p>Extend the given DCG for mini-algol to support the if-statement. You can assume that both branches are present in every if-statement. Example:</p>
<pre>
  % if a < b then
  %   print(a)
  % else
  %   print(b)
  % end
  ?- _Program = [begin,if,a,<,b,then,print(a),else,print(b),end,end],
      algol_if(_F, _Program, []),
      apply([a=3,b=5], Output, _F).
    Output = [a=3,b=5,printout=[3]].
</pre>
'''

hint = {}