?- use_module(library(dcgs)).
true.
?- op(1105,xfy,'|').
true.
?- phrase(("a"|"b"),L).
caught: error(existence_error(procedure,('|')/4),('|')/4)
?- phrase(("a";"b"),L).
L = [a] ;
L = [b].
Ideally, ('|')//2 describes an alternative, but rejects if-then-else during term-to-body conversion.
I don't know how to retain the usual meaning of ('|') as a head-tail separator in lists while overloading it as an operator (or if I should).
(So this is now a syntax question only) There is no ambiguity between head-separator and the infix bar operator, since the infix bar must have a priority of 1001 or higher. See http://www.complang.tuwien.ac.at/ulrich/iso-prolog/dtc2#Res_A78 The elements within a list have always been restricted to See in 6.3.5 the use of non-terminal arg defined in 6.3.3.1 reading:
arg = atom ;
Abstract: a a
Condition: a is an operator
arg = term ;
Abstract: a a
Priority: 999
Ambiguity would only arise with smaller priority.
In any case for library(dcgs), within the actual module, the bar must be written in functional notation.
Now its all wrong, one level too much:
?- phrase(("a"|"b"),L).
L = [[a]] ;
L = [[b]].
?- phrase("a",L).
L = [[a]].
?- L = "a".
L = [a].
?- phrase(("a";"b"),L).
L = [[a]] ;
L = [[b]].