From bbcb29a202436fc0e222e187f1fadf0b1f305465 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Sun, 22 May 2016 17:48:30 +0200 Subject: Prolog: update denotational_semantics problems --- .../denotational_semantics/prog_listswap_2/common.py | 18 +++++++++++++++--- .../denotational_semantics/prog_listswap_2/en.py | 12 ++++++++++-- 2 files changed, 25 insertions(+), 5 deletions(-) (limited to 'prolog/problems/denotational_semantics/prog_listswap_2') diff --git a/prolog/problems/denotational_semantics/prog_listswap_2/common.py b/prolog/problems/denotational_semantics/prog_listswap_2/common.py index e08337d..b3da01f 100644 --- a/prolog/problems/denotational_semantics/prog_listswap_2/common.py +++ b/prolog/problems/denotational_semantics/prog_listswap_2/common.py @@ -1,10 +1,10 @@ id = 175 -number = 79 -visible = False +number = 10 +visible = True facts = None solution = '''\ -program --> [begin], instructs175, [end]. +prog_listswap --> [begin], instructs175, [end]. instructs175 --> instr175. instructs175 --> instr175, instructs175. @@ -13,3 +13,15 @@ instr175 --> [left]. instr175 --> [right]. instr175 --> [swap]. ''' + +# nothing to do in this exercise +initial = '''\ +prog_listswap --> [begin], instructs, [end]. + +instructs --> instr. +instructs --> instr, instructs. + +instr --> [left]. +instr --> [right]. +instr --> [swap]. +''' diff --git a/prolog/problems/denotational_semantics/prog_listswap_2/en.py b/prolog/problems/denotational_semantics/prog_listswap_2/en.py index ad0e9b1..89907bd 100644 --- a/prolog/problems/denotational_semantics/prog_listswap_2/en.py +++ b/prolog/problems/denotational_semantics/prog_listswap_2/en.py @@ -2,9 +2,17 @@ name = 'prog_listswap/2' slug = 'list-manipulation language' description = '''\ -

Write a DCG for manipulating list elements. The first symbol in every word is [begin], followed by any sequence of "instruction" symbols from the set {left, right, swap}, and finally [end]. The starting symbol should be named prog_listswap.

+

+Write a DCG for manipulating list elements. The first symbol in every word is +[begin], followed by any sequence of "instruction" symbols from +the set {left, right, swap}, and finally +[end]. The starting symbol should be named +prog_listswap. +

-

Example words: [begin,right,swap,end], [begin,right,left,end].

+

+Example words: [begin,right,swap,end], [begin,right,left,end]. +

''' hint = {} -- cgit v1.2.1