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

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 = {}