xo-interpreter2: work towards utest w/ vsm+reader [WIP]
This commit is contained in:
parent
b69098af0d
commit
a10c7dcab2
10 changed files with 224 additions and 4 deletions
|
|
@ -5,9 +5,12 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "VsmConfig.hpp"
|
||||
#include "VsmInstr.hpp"
|
||||
#include <xo/reader2/SchematikaReader.hpp>
|
||||
#include <xo/expression2/Expression.hpp>
|
||||
#include <xo/gc/GCObject.hpp>
|
||||
#include <xo/facet/box.hpp>
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
|
|
@ -18,10 +21,11 @@ namespace xo {
|
|||
public:
|
||||
// will be DArenaVector<obj<StackFrame>> probably
|
||||
using Stack = void *;
|
||||
using AAllocator = xo::mm::AAllocator;
|
||||
using AGCObject = xo::mm::AGCObject;
|
||||
|
||||
public:
|
||||
VirtualSchematikaMachine();
|
||||
VirtualSchematikaMachine(const VsmConfig & config);
|
||||
|
||||
/** borrow calling thread to run indefinitely,
|
||||
* until halt instruction
|
||||
|
|
@ -93,6 +97,14 @@ namespace xo {
|
|||
* value_
|
||||
*/
|
||||
|
||||
/** configuration **/
|
||||
VsmConfig config_;
|
||||
|
||||
box<AAllocator> mm_;
|
||||
|
||||
/** reader: text -> expression **/
|
||||
SchematikaReader reader_;
|
||||
|
||||
/** program counter **/
|
||||
VsmInstr pc_ = VsmInstr::halt();
|
||||
|
||||
|
|
|
|||
28
include/xo/interpreter2/VsmConfig.hpp
Normal file
28
include/xo/interpreter2/VsmConfig.hpp
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/** @file VsmConfig.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <xo/reader2/ReaderConfig.hpp>
|
||||
#include <xo/gc/X1CollectorConfig.hpp>
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
/** Configuration for virtual schematika machine
|
||||
**/
|
||||
struct VsmConfig {
|
||||
using X1CollectorConfig = xo::mm::X1CollectorConfig;
|
||||
|
||||
/** reader configuration **/
|
||||
ReaderConfig rdr_config_;
|
||||
/** Configuration for allocator/collector.
|
||||
* TODO: may want to make CollectorConfig polymorphic
|
||||
**/
|
||||
X1CollectorConfig x1_config_ = X1CollectorConfig().with_size(4*1024*1024);
|
||||
};
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end VsmConfig.hpp */
|
||||
21
include/xo/interpreter2/init_interpreter2.hpp
Normal file
21
include/xo/interpreter2/init_interpreter2.hpp
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/** @file init_interpreter2.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <xo/subsys/Subsystem.hpp>
|
||||
|
||||
namespace xo {
|
||||
/* tag to represent the xo-interpreter2/ subsystem within ordered initialization */
|
||||
enum S_interpreter2_tag {};
|
||||
|
||||
template <>
|
||||
struct InitSubsys<S_interpreter2_tag> {
|
||||
static void init();
|
||||
static InitEvidence require();
|
||||
};
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end init_interpreter2.hpp */
|
||||
Loading…
Add table
Add a link
Reference in a new issue