Parse.add_listform : {separator : string, leftdelim : string, rightdelim : string, cons : string, nilstr : string} -> unit
<ld> str1 <sep> str2 <sep> ... strn <rd>into the term
<cons> t1 (<cons> t2 ... (<cons> tn <nilstr>))where <ld> is the left delimiter string, <rd> the right delimiter, and <sep> is the separator string from the fields of the record argument to the function. The various stri are strings representing the ti terms. Further, the grammar will also parse <ld> <rd> into <nilstr>.
In common with the add_rule function, there is no requirement that the cons and nilstr fields be the names of constants; the parser/grammar combination will generate variables with these names if there are no corresponding constants.
The HOL pretty-printer is simultaneously aware of the new rule, and terms of the forms above will print appropriately.
add_listform {separator = ";", leftdelim = "[", rightdelim = "]", cons = "CONS", nilstr = "NIL"};while the set syntax is defined similarly:
add_listform {leftdelim = "{", rightdelim = "}", separator = ";", cons = "INSERT", nilstr = "EMPTY"};