xo-interpreter2: + nil + cons

This commit is contained in:
Roland Conybeare 2026-03-11 16:19:40 -05:00
commit cc42c98928
22 changed files with 148 additions and 5 deletions

View file

@ -18,6 +18,7 @@
#include <xo/object2/Boolean.hpp>
#include <xo/object2/Integer.hpp>
#include <xo/object2/Float.hpp>
#include <xo/object2/List.hpp>
#include <xo/stringtable2/String.hpp>
#include <xo/alloc2/GCObject.hpp>
#include <xo/facet/facet_implementation.hpp>
@ -155,6 +156,10 @@ namespace xo {
this->on_bool_token(tk, p_psm);
return;
case tokentype::tk_nil:
this->on_nil_token(tk, p_psm);
return;
case tokentype::tk_if:
this->on_if_token(tk, p_psm);
return;
@ -372,6 +377,23 @@ namespace xo {
p_psm);
}
void
DExpectExprSsm::on_nil_token(const Token & tk,
ParserStateMachine * p_psm)
{
(void)tk;
auto nil = DList::nil();
auto expr = DConstant::make(p_psm->expr_alloc(), nil);
// DProgressSsm responsible for resolving cases like
// nil ++ nil;
DProgressSsm::start(p_psm->parser_alloc(),
expr,
p_psm);
}
void
DExpectExprSsm::on_f64_token(const Token & tk,
ParserStateMachine * p_psm)