summaryrefslogtreecommitdiff
path: root/prolog/problems/dcg/paren_2
diff options
context:
space:
mode:
Diffstat (limited to 'prolog/problems/dcg/paren_2')
-rw-r--r--prolog/problems/dcg/paren_2/common.py10
-rw-r--r--prolog/problems/dcg/paren_2/en.py10
2 files changed, 20 insertions, 0 deletions
diff --git a/prolog/problems/dcg/paren_2/common.py b/prolog/problems/dcg/paren_2/common.py
new file mode 100644
index 0000000..ce5ec87
--- /dev/null
+++ b/prolog/problems/dcg/paren_2/common.py
@@ -0,0 +1,10 @@
+id = 168
+group = 'dcg'
+number = 75
+visible = True
+facts = None
+
+solution = '''\
+paren --> [].
+paren --> ['('], paren, [')'], paren.
+'''
diff --git a/prolog/problems/dcg/paren_2/en.py b/prolog/problems/dcg/paren_2/en.py
new file mode 100644
index 0000000..a4ab666
--- /dev/null
+++ b/prolog/problems/dcg/paren_2/en.py
@@ -0,0 +1,10 @@
+id = 168
+name = 'paren/2'
+slug = 'properly nested parens'
+
+description = '''\
+<p>Write a DCG with the starting symbol <code>paren</code> for the language of properly nested sequences of parentheses. The terminal symbols in the grammar should be written like this: <code>['(']</code> and <code>[')']</code>.</p>
+<p>Example words: <code>()</code>, <code>(())</code>, <code>()(())</code>, <code>(()())()</code>.</p>
+<p>Example non-words: <code>)(</code>, <code>((()</code>, <code>))</code>.</p>'''
+
+hint = {}