Huge update, backup commit.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "Architecture.h"
|
||||
#include "Language.h"
|
||||
#include "Stack.h"
|
||||
#include "Symbol.h"
|
||||
|
||||
class Compiler
|
||||
@@ -12,12 +13,14 @@ class Compiler
|
||||
private:
|
||||
const Architecture *architecture;
|
||||
const Language *language;
|
||||
ehs::UInt_64 entryPointId;
|
||||
ehs::Str_8 entryPointName;
|
||||
ehs::Array<Symbol> symbols;
|
||||
|
||||
public:
|
||||
Compiler();
|
||||
|
||||
Compiler(const ehs::Str_8 &arch, const ehs::Str_8 &lang);
|
||||
Compiler(const ehs::Str_8 &arch, const ehs::Str_8 &lang, ehs::Str_8 entryPoint);
|
||||
|
||||
Compiler(Compiler &&other) noexcept;
|
||||
|
||||
@@ -27,18 +30,42 @@ public:
|
||||
|
||||
Compiler &operator=(const Compiler &other);
|
||||
|
||||
ehs::Array<ehs::Byte> Compile(const ehs::Str_8 &code) const;
|
||||
bool HasSymbol(const ehs::UInt_64 &id) const;
|
||||
|
||||
bool HasSymbol(const ehs::Str_8 &name) const;
|
||||
|
||||
bool AddSymbol(Symbol symbol);
|
||||
|
||||
Symbol *GetSymbol(const ehs::UInt_64 &id) const;
|
||||
|
||||
Symbol *GetSymbol(const ehs::Str_8 &name) const;
|
||||
|
||||
ehs::Vector<ehs::Byte> Compile(const ehs::Str_8 &code);
|
||||
|
||||
private:
|
||||
static bool IsEOL(const ehs::Array<ehs::Char_8> &eols, const ehs::Char_8 *c);
|
||||
static bool IsNumber(const ehs::Char_8 *c);
|
||||
|
||||
static bool IsSeparator(const ehs::Array<ehs::Char_8> &separators, const ehs::Char_8 *c);
|
||||
static bool IsOperator(const ehs::Char_8 *c);
|
||||
|
||||
static bool IsAlphabet(const ehs::Char_8 *c);
|
||||
|
||||
static bool IsAlphaNumeric(const ehs::Char_8 *c);
|
||||
|
||||
static bool IsPrimitive(const ehs::Array<Primitive> &primitives, const ehs::Str_8 &value);
|
||||
|
||||
static bool IsKeyword(const ehs::Array<ehs::Str_8> &keywords, const ehs::Str_8 &value);
|
||||
|
||||
static const Operator *IsOperator(const ehs::Array<Operator> &operators, const ehs::Str_8 &value);
|
||||
static bool IsEncapsulator(const ehs::Char_8 *c);
|
||||
|
||||
ehs::Vector<Token> Parse(const ehs::Str_8 &code) const;
|
||||
static bool IsEOL(const ehs::Array<ehs::Char_8> &eols, const ehs::Char_8 *c);
|
||||
|
||||
static void ParseNumber(ehs::Vector<Token> &tokens, const ehs::Array<ehs::Char_8> &eols, ehs::Char_8 **start, ehs::Char_8 **i);
|
||||
|
||||
static void ParseOperator(ehs::Vector<Token> &tokens, const ehs::Array<ehs::Char_8> &eols, ehs::Char_8 **start, ehs::Char_8 **i);
|
||||
|
||||
static void ParseText(ehs::Vector<Token> &tokens, const ehs::Array<ehs::Char_8> &eols,
|
||||
const ehs::Array<Primitive> &primitives, const ehs::Array<ehs::Str_8> &keywords, ehs::Char_8 **start,
|
||||
ehs::Char_8 **i);
|
||||
|
||||
ehs::Vector<Token> ParseIntoTokens(const ehs::Str_8 &code) const;
|
||||
};
|
Reference in New Issue
Block a user