Backup.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <ehs/Types.h>
|
||||
|
||||
class Arctyx
|
||||
class EHS_LIB_IO Arctyx
|
||||
{
|
||||
private:
|
||||
static void Initialize();
|
||||
|
@@ -4,14 +4,16 @@
|
||||
|
||||
#include "Instruction.h"
|
||||
|
||||
class Architecture
|
||||
class EHS_LIB_IO Architecture
|
||||
{
|
||||
private:
|
||||
friend class Arctyx;
|
||||
|
||||
ehs::UInt_64 id;
|
||||
ehs::Str_8 name;
|
||||
ehs::Array<Instruction> instructions;
|
||||
|
||||
static ehs::Array<Architecture> architectures;
|
||||
static ehs::Array<const Architecture *> architectures;
|
||||
|
||||
public:
|
||||
Architecture();
|
||||
|
@@ -1,15 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <ehs/Array.h>
|
||||
|
||||
#include "Token.h"
|
||||
|
||||
class Combination
|
||||
{
|
||||
private:
|
||||
ehs::Array<TokenType> tokens;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
};
|
@@ -1 +1,21 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include <ehs/Array.h>
|
||||
#include <ehs/Serializer.h>
|
||||
|
||||
#include "Architecture.h"
|
||||
#include "Language.h"
|
||||
#include "Symbol.h"
|
||||
|
||||
class Compiler
|
||||
{
|
||||
private:
|
||||
const Architecture *architecture;
|
||||
const Language *language;
|
||||
ehs::Array<Symbol> symbols;
|
||||
|
||||
public:
|
||||
Compiler();
|
||||
|
||||
Compiler(const Architecture *arch, const Language *lang);
|
||||
};
|
@@ -1,10 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <ehs/Str.h>
|
||||
#include <ehs/Types.h>
|
||||
|
||||
class Instruction
|
||||
class Architecture;
|
||||
|
||||
class EHS_LIB_IO Instruction
|
||||
{
|
||||
private:
|
||||
friend class Architecture;
|
||||
|
||||
Architecture *arch;
|
||||
ehs::UInt_64 id;
|
||||
ehs::Str_8 name;
|
||||
ehs::UInt_8 size;
|
||||
@@ -33,6 +39,8 @@ public:
|
||||
|
||||
Instruction &operator=(const Instruction &ins);
|
||||
|
||||
const Architecture *GetArchitecture() const;
|
||||
|
||||
ehs::UInt_64 GetId() const;
|
||||
|
||||
ehs::Str_8 GetName() const;
|
||||
|
27
include/arctyx/compiler/Interpretation.h
Normal file
27
include/arctyx/compiler/Interpretation.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include <ehs/Array.h>
|
||||
|
||||
#include "Instruction.h"
|
||||
#include "Token.h"
|
||||
|
||||
class EHS_LIB_IO Interpretation : public Token
|
||||
{
|
||||
private:
|
||||
Instruction result;
|
||||
|
||||
public:
|
||||
Interpretation() = default;
|
||||
|
||||
Interpretation(const TokenT &type, ehs::Str_8 value, Instruction result);
|
||||
|
||||
Interpretation(Interpretation &&other) noexcept;
|
||||
|
||||
Interpretation(const Interpretation &other);
|
||||
|
||||
Interpretation &operator=(Interpretation &&other) noexcept;
|
||||
|
||||
Interpretation &operator=(const Interpretation &other);
|
||||
|
||||
Instruction GetResult() const;
|
||||
};
|
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "Instruction.h"
|
||||
|
||||
class Keyword
|
||||
class EHS_LIB_IO Keyword
|
||||
{
|
||||
private:
|
||||
ehs::Str_8 identifier;
|
||||
|
@@ -3,22 +3,28 @@
|
||||
#include <ehs/Array.h>
|
||||
#include <ehs/Str.h>
|
||||
#include <ehs/Types.h>
|
||||
#include <ehs/Version.h>
|
||||
|
||||
#include "Combination.h"
|
||||
#include "Interpretation.h"
|
||||
|
||||
class Language
|
||||
class EHS_LIB_IO Language
|
||||
{
|
||||
private:
|
||||
friend class Arctyx;
|
||||
|
||||
ehs::UInt_64 id;
|
||||
ehs::Str_8 name;
|
||||
ehs::Array<ehs::Str_8> keywords;
|
||||
ehs::Version version;
|
||||
ehs::Char_8 eol;
|
||||
ehs::Array<ehs::Char_8> separators;
|
||||
ehs::Array<Combination> interpretations;
|
||||
ehs::Array<Interpretation> interpretations;
|
||||
|
||||
static ehs::Array<const Language *> languages;
|
||||
|
||||
public:
|
||||
Language();
|
||||
|
||||
Language(ehs::Str_8 name);
|
||||
Language(ehs::Str_8 name, const ehs::Version &version);
|
||||
|
||||
Language(Language &&lang) noexcept;
|
||||
|
||||
@@ -32,4 +38,34 @@ public:
|
||||
|
||||
ehs::Str_8 GetName() const;
|
||||
|
||||
ehs::Version GetVersion() const;
|
||||
|
||||
void SetEOL(const ehs::Char_8 &newEOL);
|
||||
|
||||
ehs::Char_8 GetEOL() const;
|
||||
|
||||
ehs::Array<ehs::Char_8> GetSeparators() const;
|
||||
|
||||
bool HasSeparator(const ehs::Char_8 &separator) const;
|
||||
|
||||
bool AddSeparator(const ehs::Char_8 &separator);
|
||||
|
||||
ehs::Array<Interpretation> GetInterpretations() const;
|
||||
|
||||
bool HasInterpretation(const TokenT &type, const ehs::Str_8 &name) const;
|
||||
|
||||
const Interpretation *GetInterpretation(const TokenT &type, const ehs::Str_8 &name) const;
|
||||
|
||||
bool AddInterpretation(Interpretation interpretation);
|
||||
|
||||
static bool Has(const ehs::UInt_64 &id);
|
||||
|
||||
static bool Has(const ehs::Str_8 &name);
|
||||
|
||||
static const Language *Get(const ehs::UInt_64 &id);
|
||||
|
||||
static const Language *Get(const ehs::Str_8 &name);
|
||||
|
||||
static bool Add(Language lang);
|
||||
|
||||
};
|
||||
|
44
include/arctyx/compiler/Symbol.h
Normal file
44
include/arctyx/compiler/Symbol.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include <ehs/Str.h>
|
||||
#include <ehs/Types.h>
|
||||
|
||||
enum class SymbolType
|
||||
{
|
||||
UNKNOWN,
|
||||
VARIABLE,
|
||||
FUNCTION,
|
||||
CLASS,
|
||||
MEMBER,
|
||||
METHOD
|
||||
};
|
||||
|
||||
class Symbol
|
||||
{
|
||||
private:
|
||||
SymbolType type;
|
||||
ehs::UInt_64 id;
|
||||
ehs::Str_8 name;
|
||||
ehs::UInt_64 address;
|
||||
|
||||
public:
|
||||
Symbol();
|
||||
|
||||
Symbol(const SymbolType &type, ehs::Str_8 name, const ehs::UInt_64 &address);
|
||||
|
||||
Symbol(Symbol &&other) noexcept;
|
||||
|
||||
Symbol(const Symbol &other);
|
||||
|
||||
Symbol &operator=(Symbol &&other) noexcept;
|
||||
|
||||
Symbol &operator=(const Symbol &other);
|
||||
|
||||
SymbolType GetType() const;
|
||||
|
||||
ehs::Str_8 GetName() const;
|
||||
|
||||
ehs::UInt_64 GetId() const;
|
||||
|
||||
ehs::UInt_64 GetAddress() const;
|
||||
};
|
@@ -2,8 +2,9 @@
|
||||
|
||||
#include <ehs/Str.h>
|
||||
|
||||
enum class TokenType : ehs::UInt_8
|
||||
enum class TokenT : ehs::UInt_8
|
||||
{
|
||||
UNKNOWN,
|
||||
VALUE,
|
||||
KEYWORD,
|
||||
IDENTIFIER,
|
||||
@@ -11,16 +12,16 @@ enum class TokenType : ehs::UInt_8
|
||||
COMPOUND_OPERATOR
|
||||
};
|
||||
|
||||
class Token
|
||||
class EHS_LIB_IO Token
|
||||
{
|
||||
private:
|
||||
TokenType type;
|
||||
TokenT type;
|
||||
ehs::Str_8 value;
|
||||
|
||||
public:
|
||||
Token();
|
||||
|
||||
Token(TokenType type, ehs::Str_8 value);
|
||||
Token(const TokenT &type, ehs::Str_8 value);
|
||||
|
||||
Token(Token &&token) noexcept;
|
||||
|
||||
@@ -30,7 +31,7 @@ public:
|
||||
|
||||
Token &operator=(const Token &token);
|
||||
|
||||
TokenType GetType() const;
|
||||
TokenT GetType() const;
|
||||
|
||||
ehs::Str_8 GetValue() const;
|
||||
};
|
||||
|
@@ -17,7 +17,7 @@
|
||||
#define ELF_64_BIT_HEADER_SIZE 64
|
||||
#define ELF_32_BIT_HEADER_SIZE 52
|
||||
|
||||
class ELF
|
||||
class EHS_LIB_IO ELF
|
||||
{
|
||||
private:
|
||||
ehs::UInt_8 bitDepth;
|
||||
|
@@ -14,7 +14,7 @@
|
||||
|
||||
class ELF;
|
||||
|
||||
class ELF_Program
|
||||
class EHS_LIB_IO ELF_Program
|
||||
{
|
||||
private:
|
||||
friend class ELF;
|
||||
|
@@ -17,7 +17,7 @@
|
||||
|
||||
#define SECH_SIZE 64
|
||||
|
||||
class ELF_Section
|
||||
class EHS_LIB_IO ELF_Section
|
||||
{
|
||||
private:
|
||||
friend class ELF;
|
||||
|
@@ -74,7 +74,7 @@
|
||||
|
||||
#define SYMH_SIZE 24
|
||||
|
||||
class ELF_Sym
|
||||
class EHS_LIB_IO ELF_Sym
|
||||
{
|
||||
private:
|
||||
ehs::UInt_32 nameOffset;
|
||||
|
Reference in New Issue
Block a user