xo-interpreter2: scaffold repl + alloc measurement frameowkr

This commit is contained in:
Roland Conybeare 2026-02-02 21:55:34 -05:00
commit f6aae4190e
42 changed files with 1398 additions and 198 deletions

View file

@ -16,6 +16,7 @@
#include <stdexcept>
namespace xo {
using xo::mm::MemorySizeInfo;
using xo::print::APrintable;
using xo::facet::FacetRegistry;
using xo::facet::with_facet;
@ -53,6 +54,29 @@ namespace xo {
return this->stack_->top();
}
std::size_t
ParserStateMachine::_n_store() const noexcept
{
return stringtable_._n_store() + 1;
}
MemorySizeInfo
ParserStateMachine::_store_info(std::size_t i) const noexcept
{
size_t n0 = stringtable_._n_store();
if (i < n0)
return stringtable_._store_info(i);
if (i == n0)
return parser_alloc_._store_info();
// not counting expr_alloc_. We don't consider
// that to be owned by ParserStateMachine
return MemorySizeInfo::sentinel();
}
void
ParserStateMachine::establish_toplevel_ssm(obj<ASyntaxStateMachine> ssm)
{