summaryrefslogtreecommitdiff
path: root/prolog/problems/denotational_semantics/algol_if_3/en.py
blob: bd5b7323e84634800488aedadb9a072c09a0f253 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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 = {}