xo-expression2: scaffold variable eval in VSM
This commit is contained in:
parent
c4f31592fc
commit
6cd861f47e
3 changed files with 19 additions and 0 deletions
|
|
@ -31,8 +31,10 @@ namespace xo {
|
|||
apply,
|
||||
/** function definition **/
|
||||
lambda,
|
||||
#endif
|
||||
/** variable reference **/
|
||||
variable,
|
||||
#ifdef NOT_YET
|
||||
/** if-then-else **/
|
||||
ifexpr,
|
||||
/** sequence **/
|
||||
|
|
|
|||
|
|
@ -45,6 +45,12 @@ namespace xo {
|
|||
**/
|
||||
void _do_eval_constant_op();
|
||||
|
||||
/** evaluate a variable expression
|
||||
* Require:
|
||||
* - expression in @ref expr_
|
||||
**/
|
||||
void _do_eval_variable_op();
|
||||
|
||||
private:
|
||||
/*
|
||||
* Some registers are preserved by evaluation:
|
||||
|
|
@ -60,8 +66,10 @@ namespace xo {
|
|||
/** program counter **/
|
||||
VsmInstr pc_ = VsmInstr::halt();
|
||||
|
||||
#ifdef NOT_YET
|
||||
/** stack pointer **/
|
||||
Stack stack_;
|
||||
#endif
|
||||
|
||||
/** expression register **/
|
||||
obj<AExpression> expr_;
|
||||
|
|
|
|||
|
|
@ -45,6 +45,9 @@ namespace xo {
|
|||
case exprtype::constant:
|
||||
_do_eval_constant_op();
|
||||
break;
|
||||
case exprtype::variable:
|
||||
_do_eval_variable_op();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -58,6 +61,12 @@ namespace xo {
|
|||
this->pc_ = this->cont_;
|
||||
}
|
||||
|
||||
void
|
||||
VirtualSchematikaMachine::_do_eval_variable_op()
|
||||
{
|
||||
// not implemented
|
||||
assert(false);
|
||||
}
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue