potassco / clingo

🤔 A grounder and solver for logic programs.
https://potassco.org/clingo
MIT License
601 stars 79 forks source link

Jorge/assignment #373

Closed jorgefandinno closed 2 years ago

jorgefandinno commented 2 years ago

Hi,

I have looking at the left guard problem. I managed to parse a grammar of the form

term theory_op & theory_atom_name { ... }

term is a term not a theory_term, but theory_op it is a theory operator different from :-. Note that allowing :- as a theory operator in the left guard makes the grammar ambiguous. For instance,

p(X) :- &sum{...}.

could be read as a rule with &sum{...} or as a fact where all of it is a theory atom.

File

libgringo/tests/left_guard.py

contains a test using the python api.

I have a question. I can parse the input, but I don't know how to create the appropriated theory atom. Right now I always create the same guard independently of what I parse. The constructor for a theory atom takes as input a theory term, but I have a regular term.

I assume that I will need to convert the term into a theory term. Does it make sense? Is there a way to do that?