Work in progress

This commit is contained in:
Patrick Lühne 2020-01-25 12:55:23 +01:00
parent a7e8368634
commit b95bda810a
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
2 changed files with 33 additions and 11 deletions

View File

@ -1,10 +1,6 @@
struct Context
{
}
struct StatementHandler<'context>
{
context: &'context mut Context,
context: &'context mut anthem::translate::verify_properties::Context,
}
impl clingo::StatementHandler for StatementHandler<'_>
@ -15,7 +11,7 @@ impl clingo::StatementHandler for StatementHandler<'_>
{
clingo::ast::StatementType::Rule(ref rule) =>
{
println!("got rule {:?}", rule)
anthem::translate::verify_properties::read(rule, self.context)
},
_ => println!("got other kind of statement"),
}
@ -37,8 +33,11 @@ impl clingo::Logger for Logger
fn main() -> Result<(), Box<dyn std::error::Error>>
{
let program = std::fs::read_to_string("test.lp")?;
let mut context = Context{};
let mut statement_handler = StatementHandler{context: &mut context};
let mut context = anthem::translate::verify_properties::Context::new();
let mut statement_handler = StatementHandler
{
context: &mut context
};
clingo::parse_program_with_logger(&program, &mut statement_handler, &mut Logger, std::u32::MAX)?;
Ok(())

View File

@ -1,8 +1,31 @@
struct Context
pub struct ScopedFormula
{
free_variable_declarations: foliage::VariableDeclarations,
formula: foliage::Formula,
}
fn read(rule: &clingo::ast::Rule, context: &mut crate::Context)
pub struct Context
{
scoped_formulas: Vec<ScopedFormula>,
}
impl Context
{
pub fn new() -> Self
{
Self
{
scoped_formulas: vec![],
}
}
}
pub fn translate_body ...
pub fn read(rule: &clingo::ast::Rule, context: &mut Context)
{
let mut variable_declaration_stack: foliage::VariableDeclarationStack;
println!("{:?}", rule.head());
println!("{:?}", rule.body());
}