diff options
author | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2016-01-13 13:51:15 +0100 |
---|---|---|
committer | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2016-01-13 13:51:15 +0100 |
commit | 388b32039898cc8f1784378689007254eb7a33b6 (patch) | |
tree | ac9e4c6145ad323dc5479179a04f44bbcea73eff /prolog/problems/denotational_semantics | |
parent | e36a8a2feca7552d236c0f6e89ac73e7e690e7b1 (diff) |
Remove space-padding from <pre> blocks
Diffstat (limited to 'prolog/problems/denotational_semantics')
5 files changed, 41 insertions, 41 deletions
diff --git a/prolog/problems/denotational_semantics/algol_3/en.py b/prolog/problems/denotational_semantics/algol_3/en.py index c5da13e..59a9bd2 100644 --- a/prolog/problems/denotational_semantics/algol_3/en.py +++ b/prolog/problems/denotational_semantics/algol_3/en.py @@ -6,28 +6,28 @@ slug = 'interpreter for mini-algol' description = '''\ <p>A DCG for mini-algol.</p> <pre> - % apply a function to a starting state - ?- apply([a=2], Out, fun(_In, Out, eval(a+3, _In, Out))). - Out = 5. +% apply a function to a starting state +?- apply([a=2], Out, fun(_In, Out, eval(a+3, _In, Out))). + Out = 5. - % a := a+b - % b := a-b - % a := a-b - ?- _Program = [begin,a,:=,a+b,b,:=,a-b,a,:=,a-b,end], - algol(_F, _Program, []), - apply([a=3,b=5], Output, _F). - Output = [a=5,b=3,printout=[]]. +% a := a+b +% b := a-b +% a := a-b +?- _Program = [begin,a,:=,a+b,b,:=,a-b,a,:=,a-b,end], + algol(_F, _Program, []), + apply([a=3,b=5], Output, _F). + Output = [a=5,b=3,printout=[]]. - % a := 0 - % while a < 10 do - % begin - % print(a) - % a := a+1 - % end - ?- _Program = [begin,a,:=,0,while,a,<,10,do,begin,print(a),a,:=,a+1,end,end], - algol(_F, _Program, []), - apply([a=3], Output, _F). - Output = [a=10,printout=[0,1,2,3,4,5,6,7,8,9]]. +% a := 0 +% while a < 10 do +% begin +% print(a) +% a := a+1 +% end +?- _Program = [begin,a,:=,0,while,a,<,10,do,begin,print(a),a,:=,a+1,end,end], + algol(_F, _Program, []), + apply([a=3], Output, _F). + Output = [a=10,printout=[0,1,2,3,4,5,6,7,8,9]]. </pre> ''' diff --git a/prolog/problems/denotational_semantics/algol_for_3/en.py b/prolog/problems/denotational_semantics/algol_for_3/en.py index d4b8144..91ff34d 100644 --- a/prolog/problems/denotational_semantics/algol_for_3/en.py +++ b/prolog/problems/denotational_semantics/algol_for_3/en.py @@ -6,14 +6,14 @@ slug = 'interpreter for mini-algol with for-statement' description = '''\ <p>Extend the given DCG for mini-algol to support the for-statement. Example:</p> <pre> - % for a := 0 & a < 5 & a := a + 1 do - % begin - % print(a) - % end - ?- _Program = [begin,for,a,:=,0,&,a,<,5,&,a,:=,a+1,do,begin,print(a),end,end], - algol_for(_F, _Program, []), - apply([a=2], Output, _F). - Output = [a=5,printout=[0,1,2,3,4]]. +% for a := 0 & a < 5 & a := a + 1 do +% begin +% print(a) +% end +?- _Program = [begin,for,a,:=,0,&,a,<,5,&,a,:=,a+1,do,begin,print(a),end,end], + algol_for(_F, _Program, []), + apply([a=2], Output, _F). + Output = [a=5,printout=[0,1,2,3,4]]. </pre> ''' diff --git a/prolog/problems/denotational_semantics/algol_if_3/en.py b/prolog/problems/denotational_semantics/algol_if_3/en.py index fae6c45..66855e5 100644 --- a/prolog/problems/denotational_semantics/algol_if_3/en.py +++ b/prolog/problems/denotational_semantics/algol_if_3/en.py @@ -6,15 +6,15 @@ 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]]. +% 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> ''' diff --git a/prolog/problems/denotational_semantics/prog_8puzzle_3/en.py b/prolog/problems/denotational_semantics/prog_8puzzle_3/en.py index 1c23b18..6a31496 100644 --- a/prolog/problems/denotational_semantics/prog_8puzzle_3/en.py +++ b/prolog/problems/denotational_semantics/prog_8puzzle_3/en.py @@ -9,8 +9,8 @@ description = '''\ <p>The meaning of a word (program) in this language has the form <code>In-->Out</code>, mapping from input to output states. Each state is a (permuted) list of numbers from 0 to 8, where 0 stands for the empty square and other numbers for the corresponding tiles. The first three numbers in the list correspond to the top row of the 8-puzzle, the next three numbers to the middle row, and the last three numbers to the last row. The meaning of instructions <code>left</code>, <code>right</code>, <code>up</code> and <code>down</code> is to move the blank tile in the given direction.</p> <pre> - ?- prog_8puzzle([0,1,2,3,4,5,6,7,8]-->Out, [begin,down,right,end], []). - Out = [3,1,2,4,0,5,6,7,8]. +?- prog_8puzzle([0,1,2,3,4,5,6,7,8]-->Out, [begin,down,right,end], []). + Out = [3,1,2,4,0,5,6,7,8]. </pre> <p>Helper predicates (already defined):<br /> diff --git a/prolog/problems/denotational_semantics/prog_listswap_3/en.py b/prolog/problems/denotational_semantics/prog_listswap_3/en.py index 5e85ce6..ad9dcf8 100644 --- a/prolog/problems/denotational_semantics/prog_listswap_3/en.py +++ b/prolog/problems/denotational_semantics/prog_listswap_3/en.py @@ -9,8 +9,8 @@ description = '''\ <p>The meaning of a word (program) in this language has the form <code>In-->Out</code>, mapping from input to output lists. Besides the list contents, internal states also hold the current cursor position. The <code>left</code> and <code>right</code> instructions move the cursor one step in the given direction, while the <code>swap</code> instruction swaps the element under the cursor with its left neighbor (and fails if cursor is currently pointing to the first element of the list).</p> <pre> - ?- prog_listswap([1,2,3,4]-->Out, [begin,right,swap,end], []). - Out = [2,1,3,4]. +?- prog_listswap([1,2,3,4]-->Out, [begin,right,swap,end], []). + Out = [2,1,3,4]. </pre> <p>Helper predicate (already defined):<br /> |