foliage-rs/src/ast.rs

77 lines
1.2 KiB
Rust

#[derive(PartialEq)]
pub struct PredicateDeclaration
{
pub name: String,
pub arity: usize,
}
#[derive(PartialEq)]
pub struct Predicate
{
pub declaration: PredicateDeclaration,
pub arguments: Vec<Term>,
}
#[derive(PartialEq)]
pub struct Exists
{
pub parameters: Vec<VariableDeclaration>,
pub argument: Box<Formula>,
}
#[derive(PartialEq)]
pub struct ForAll
{
pub parameters: Vec<VariableDeclaration>,
pub argument: Box<Formula>,
}
#[derive(PartialEq)]
pub enum Formula
{
Exists(Exists),
ForAll(ForAll),
Not(Box<Formula>),
And(Vec<Box<Formula>>),
Or(Vec<Box<Formula>>),
Implies(Box<Formula>, Box<Formula>),
Biconditional(Box<Formula>, Box<Formula>),
Less(Term, Term),
LessOrEqual(Term, Term),
Greater(Term, Term),
GreaterOrEqual(Term, Term),
Equal(Term, Term),
NotEqual(Term, Term),
Boolean(bool),
Predicate(Predicate),
}
#[derive(PartialEq)]
pub enum Domain
{
Program,
Integer,
}
#[derive(PartialEq)]
pub struct VariableDeclaration
{
pub name: String,
pub domain: Domain,
}
#[derive(PartialEq)]
pub enum Term
{
Infimum,
Supremum,
Integer(i64),
Symbolic(String),
String(String),
Variable(VariableDeclaration),
Add(Box<Term>, Box<Term>),
Subtract(Box<Term>, Box<Term>),
Multiply(Box<Term>, Box<Term>),
Negative(Box<Term>),
}