NouVeL/NouVeL/NVL.h

75 lines
1.2 KiB
C++

#pragma once
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <regex>
#include <variant>
namespace NVL
{
struct Nil
{
};
struct Object
{
std::variant<
Nil,
float,
std::string,
bool,
std::vector<Object> // Implies Object can be an array of other Object
> Value;
bool Is_Symbol = false;
void Print(int indent);
};
struct Call
{
std::vector<Object> Objects;
void Print(int indent);
};
struct Sequence
{
std::string Name;
std::vector<Call> Calls;
Sequence()
{}
Sequence(std::string n) : Name(n)
{}
void Print(int indent);
};
struct Tree
{
std::vector<Sequence> Sequences;
void Print(int indent);
};
struct Context {
std::vector<std::variant<
std::reference_wrapper<Tree>,
std::reference_wrapper<Sequence>,
std::reference_wrapper<Call>,
std::reference_wrapper<Object>
>> Scope_Hierarchy;
};
void parse_NVL(Tree& root, std::string path);
void parse_Sequence(Context parent_context, std::ifstream& nvl);
void parse_Call(Context parent_context, std::ifstream& nvl);
template <bool is_parent_call, bool is_symbol>
void parse_Object(Context parent_context, std::ifstream& nvl);
}