I am trying to understand prolog and definite clause grammar but I am having a very hard time understanding both of them.
I am really trying to understand how to use
it's not easy to translate do/4 to DCG in meaningful way. I've removed arguments that 'copy' the hidden arguments of the DCG.
do(Sum) -->
[1], %check if H is 1
{ % braces allow 'normal' Prolog code (but we have no access to 'hidden' arguments)
Additional is H+5,
Sum is Additional+Additional
}.
edit sorry I forgot H in Additional is H+5,, should read Additional is 1+5,...