2020-01-31 17:24:13 +01:00
|
|
|
mod context;
|
|
|
|
mod translate_body;
|
2020-02-01 15:32:41 +01:00
|
|
|
mod translate_head;
|
2020-01-31 17:19:44 +01:00
|
|
|
|
2020-01-31 17:24:13 +01:00
|
|
|
pub use context::Context;
|
2020-02-01 15:32:41 +01:00
|
|
|
|
2020-01-31 17:24:13 +01:00
|
|
|
use translate_body::translate_body;
|
2020-02-01 15:32:41 +01:00
|
|
|
use translate_head::determine_head_type;
|
2020-01-25 12:55:23 +01:00
|
|
|
|
2020-02-01 15:32:41 +01:00
|
|
|
pub fn read(rule: &clingo::ast::Rule, context: &mut Context) -> Result<(), crate::Error>
|
2020-01-31 17:19:44 +01:00
|
|
|
{
|
2020-02-01 15:32:41 +01:00
|
|
|
let test = translate_body(rule.body(), context)?;
|
|
|
|
|
|
|
|
println!("{:?}", test);
|
|
|
|
|
|
|
|
let test = determine_head_type(rule.head(),
|
|
|
|
|name, arity| context.find_or_create_predicate_declaration(name, arity))?;
|
|
|
|
|
|
|
|
match test
|
|
|
|
{
|
|
|
|
translate_head::HeadType::ChoiceWithSingleAtom(_) => println!("choice single"),
|
|
|
|
translate_head::HeadType::IntegrityConstraint => println!("integrity"),
|
|
|
|
translate_head::HeadType::Trivial => println!("trivial"),
|
|
|
|
_ => (),
|
|
|
|
}
|
|
|
|
|
|
|
|
Ok(())
|
2020-01-24 13:32:43 +01:00
|
|
|
}
|