add provisional functor and arg support, and give ';' and '->' their true semantics

This commit is contained in:
Mark Thom
2018-01-08 21:14:19 -07:00
parent 750e7d91ed
commit d49157bef6
12 changed files with 454 additions and 100 deletions

View File

@@ -1,3 +1,4 @@
macro_rules! internal_call_n {
() => (
Line::BuiltIn(BuiltInInstruction::InternalCallN)
@@ -99,12 +100,24 @@ macro_rules! put_var {
)
}
macro_rules! put_structure {
($lvl:expr, $name:expr, $arity:expr, $r:expr) => (
QueryInstruction::PutStructure($lvl, $name, $arity, $r)
)
}
macro_rules! put_constant {
($lvl:expr, $cons:expr, $r:expr) => (
QueryInstruction::PutConstant($lvl, $cons, $r)
)
}
macro_rules! set_constant {
($cons:expr) => (
QueryInstruction::SetConstant($cons)
)
}
macro_rules! put_value {
($r:expr, $arg:expr) => (
QueryInstruction::PutValue($r, $arg)
@@ -135,6 +148,12 @@ macro_rules! is_atomic {
)
}
macro_rules! is_integer {
($reg:expr) => (
Line::BuiltIn(BuiltInInstruction::IsInteger($reg))
)
}
macro_rules! is_var {
($reg:expr) => (
Line::BuiltIn(BuiltInInstruction::IsVar($reg))
@@ -303,12 +322,30 @@ macro_rules! get_structure {
)
}
macro_rules! functor_call {
() => (
Line::Control(ControlInstruction::FunctorCall)
)
}
macro_rules! functor_execute {
() => (
Line::Control(ControlInstruction::FunctorExecute)
)
}
macro_rules! unify_variable {
($r:expr) => (
FactInstruction::UnifyVariable($r)
)
}
macro_rules! unify_void {
($n:expr) => (
FactInstruction::UnifyVoid($n)
)
}
macro_rules! set_cp {
($r:expr) => (
Line::BuiltIn(BuiltInInstruction::SetCutPoint($r))
@@ -321,4 +358,20 @@ macro_rules! get_cp {
)
}
macro_rules! integer {
($i:expr) => (
Constant::Integer(BigInt::from($i))
)
}
macro_rules! add {
($at_1:expr, $at_2:expr, $o:expr) => (
Line::Arithmetic(ArithmeticInstruction::Add($at_1, $at_2, $o))
)
}
macro_rules! get_arg {
() => (
Line::BuiltIn(BuiltInInstruction::GetArg)
)
}