I am using definite clause grammars to parse string literals in Prolog, but this grammar rule can only parse string literals that contain alphabetic characters:
string_literal(S) --> "\"", symbol(S), "\"".
symbol([L|Ls]) --> letter(L), symbol_r(Ls).
symbol_r([L|Ls]) --> letter(L), symbol_r(Ls).
symbol_r([]) --> [].
letter(Let) --> [Let], { code_type(Let, alpha) }.
Is it possible to write a DCG rule that can parse string literals with other types of symbols?