I find that SWI-Prolog offers:
atom_to_term(+Atom, -Term, -Bindings)
Use Atom as input to read_term/2 using the option variable_names
and return the read term in Term and the variable bindings in Bindings.
https://www.swi-prolog.org/pldoc/man?predicate=atom_to_term/3
But I am having a hard time, figuring out what other Prolog systems offer in this respect . Maybe some people did already obtain solutions, that they might want to share?
Example what it does:
?- atom_to_term('X + Y', T, N).
T = _A+_B,
N = ['X'=_A, 'Y'=_B].