Huge update, backup commit.

This commit is contained in:
2025-07-27 23:50:41 -07:00
parent a0cd2e00b8
commit c4011152b6
21 changed files with 775 additions and 200 deletions

View File

@@ -9,6 +9,9 @@
#include "Operator.h"
#include "Primitive.h"
typedef ehs::Vector<Token> (*CompileIntoTokensCb)(Compiler *compiler, const Language *lang, const ehs::Str_8 &code);
typedef ehs::Vector<ehs::Byte> (*CompileIntoMachineCodeCb)(Compiler *compiler, const Language *lang, const ehs::Vector<Token> &tokens);
class EHS_LIB_IO Language
{
private:
@@ -18,11 +21,12 @@ private:
ehs::Str_8 name;
ehs::Version version;
ehs::Array<ehs::Char_8> eols;
ehs::Array<ehs::Char_8> separators;
ehs::Array<Primitive> primitives;
ehs::Array<ehs::Str_8> keywords;
ehs::Array<Operator> operators;
ehs::Array<Interpretation> interpretations;
CompileIntoTokensCb compileIntoTokensCb;
CompileIntoMachineCodeCb compileIntoMachineCodeCb;
static ehs::Array<const Language *> languages;
@@ -51,12 +55,6 @@ public:
bool AddEOL(const ehs::Char_8 &eol);
ehs::Array<ehs::Char_8> GetSeparators() const;
bool HasSeparator(const ehs::Char_8 &separator) const;
bool AddSeparator(const ehs::Char_8 &separator);
ehs::Array<Primitive> GetPrimitives() const;
bool HasPrimitive(const ehs::UInt_64 &id) const;
@@ -91,6 +89,14 @@ public:
bool AddInterpretation(Interpretation interpretation);
void SetCompileIntoTokensCb(CompileIntoTokensCb cb);
ehs::Vector<Token> CompileIntoTokens(Compiler *compiler, const ehs::Str_8 &code) const;
void SetCompileIntoMachineCodeCb(CompileIntoMachineCodeCb cb);
ehs::Vector<ehs::Byte> CompileIntoMachineCode(Compiler *compiler, const ehs::Vector<Token> &tokens) const;
static bool Has(const ehs::UInt_64 &id);
static bool Has(const ehs::Str_8 &name);