Availability:
:- use_module(library(dcg/high_order)).
//
[]
for Default succeeds without any additional actions if Match
fails. For example:
?- phrase(optional(number(X), {X=0}), `23`, Tail). X = 23, Tail = []. ?- phrase(optional(number(X), {X=0}), `aap`, Tail). X = 0, Tail = `aap`.