aboutsummaryrefslogtreecommitdiff
path: root/pl/atom_dcg.pl
diff options
context:
space:
mode:
Diffstat (limited to 'pl/atom_dcg.pl')
-rw-r--r--pl/atom_dcg.pl11
1 files changed, 11 insertions, 0 deletions
diff --git a/pl/atom_dcg.pl b/pl/atom_dcg.pl
new file mode 100644
index 0000000..74689d5
--- /dev/null
+++ b/pl/atom_dcg.pl
@@ -0,0 +1,11 @@
+:- module(atom_dcg, [atom_phrase/2]).
+
+:- meta_predicate atom_phrase(2, ?).
+
+atom_phrase(G, A) :-
+ ( var(A)
+ -> phrase(G, C),
+ atom_codes(A, C)
+ ; atom_codes(A, C),
+ phrase(G, C)
+ ).