Getting parentheses to indicate precedence when interpreting clause bodies

Hi,

I don’t understand how to preserve parentheses that indicate precedence when interpreting clause bodies. The query test below yields [a, ∧ ,b, ∨ ,c] but i was expecting something like [a, ∧ , '(', b, ∨ ,c, ')']; i.e. the parentheses in BODY are kept. Can anybody give me a hint? I understand that conjunction has higher precedence than disjunction, so to indicate precedence in a disjunction i would have to use parentheses.

Cheers/JCR

test:- BODY = (a, (b; c)), parseToFol(BODY, O), writeln(O).
parseToFol(I, O):- I = ','(I1, I2), parseToFol(I1, O1), parseToFol(I2, O2), flatten([O1, ' ∧ ', O2], O).
parseToFol(I, O):- I = ';'(I1, I2), parseToFol(I1, O1), parseToFol(I2, O2), flatten([O1, ' ∨ ', O2], O).
parseToFol(I, O):- I \= ','(_, _), I \= ';'(_, _), O = [I].
transformToFol(I, O):- 
      I = ;(I1, I2), 
      transformToFol(I1, O1), 
      transformToFol(I2, O2), 
      O = ∨(O1, O2).

Thanks @anon95304481 ! This solved my problem.