1/* Part of dcgutils
2 Copyright 2012-2015 Samer Abdallah (Queen Mary University of London; UCL)
3 4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8 9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13 14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17*/
18 19:-module(dcg_pair, [
20(\<)//1 21 , (\>)//1 22 , (<\>)//2 23 , (\#)//2 24 , run_left//3 25 , run_right//3 26 , transduce/3 27 28 , op(900,fy,\<) 29 , op(900,fy,\>) 30 , op(900,xfx,<\>) 31 , op(900,xfy,\#) 32 ]).

Paired state DCG utilities

This module contains predicates for using DCGs as a tool for stateful
programming, where the state can be pair of arbitrary types. This enables
DCGs to be 'composed'.

The type pair(A,B) will be used to denote the type of terms
with functor (-)/2 and arguments of types A and B respectively:

pair(A,B) ---> A-B.

This type is used to support a set of general purpose predicates
for combining commands in two distinct DCGs into a single DCG
over a product space of states.
*/

Run a transducer between two lists of elements of type A and B respectively.
Transducer is a DCG goal working on a state which is a pair of lists. It can use
the facilities in this module to match sequences of elements in either list.