├── .Chached_Env_Paths.txt ├── .github └── ISSUE_TEMPLATE │ └── bug_report.md ├── .gitignore ├── .vscode ├── launch.json ├── settings.json └── tasks.json ├── Assemblers ├── arm_as.exe └── x86_as.exe ├── CMakeLists.txt.DEPRICATED ├── CMakeSettings.json ├── Cpp ├── Assembler │ └── Assembler.cpp ├── BackEnd │ ├── ARM.cpp │ ├── BackEnd.cpp │ ├── DebugGenerator.cpp │ ├── IRGenerator.cpp │ ├── IROptimizer.cpp │ ├── IRPostProsessor.cpp │ ├── Selector.cpp │ └── x86.cpp ├── Docker │ ├── ASM.cpp │ ├── DLL.cpp │ ├── Docker.cpp │ ├── ELF.cpp │ ├── HTTPS.cpp │ ├── LIB.cpp │ ├── Mangler.cpp │ ├── OBJ.cpp │ └── TXT.cpp ├── Lexer │ ├── Component.cpp │ ├── Lexer.cpp │ └── Position.cpp ├── Linker │ └── Linker.cpp ├── Nodes │ ├── Node.cpp │ └── Token.cpp ├── Parser │ ├── Algebra.cpp │ ├── Analyzer.cpp │ ├── Memory_Manager.cpp │ ├── Parser.cpp │ └── PostProsessor.cpp ├── PreProsessor │ └── PreProsessor.cpp ├── UI │ ├── Producer.cpp │ ├── Safe.cpp │ ├── Satellite.cpp │ ├── Service.cpp │ └── Usr.cpp └── main.cpp ├── Credits ├── NM_LICENSE.txt └── OBJECT_LICENSE.txt ├── Dependencies ├── Curl │ ├── .gitignore │ ├── Makefile.am │ ├── curl.h │ ├── curlver.h │ ├── easy.h │ ├── libcurl.lib │ ├── libcurl.so │ ├── mprintf.h │ ├── multi.h │ ├── options.h │ ├── stdcheaders.h │ ├── system.h │ ├── typecheck-gcc.h │ └── urlapi.h └── Mingw │ └── make.exe ├── Evie.sln ├── Evie.vcxproj ├── Evie.vcxproj.filters ├── Evie.vcxproj.user ├── H ├── Assembler │ ├── Assembler.h │ └── Assembler_Types.h ├── BackEnd │ ├── ARM.h │ ├── BackEnd.h │ ├── DebugGenerator.h │ ├── IRGenerator.h │ ├── IROptimizer.h │ ├── IRPostProsessor.h │ ├── Selector.h │ └── x86.h ├── Docker │ ├── ASM.h │ ├── DLL.h │ ├── Docker.h │ ├── ELF.h │ ├── HTTPS.h │ ├── LIB.h │ ├── Mangler.h │ ├── OBJ.h │ ├── Section.h │ └── TXT.h ├── Flags.h ├── Lexer │ ├── Component.h │ ├── Lexer.h │ └── Position.h ├── Linker │ └── Linker.h ├── Nodes │ ├── IR.h │ ├── Node.h │ └── Token.h ├── Parser │ ├── Algebra.h │ ├── Analyzer.h │ ├── Memory_Manager.h │ ├── Parser.h │ └── PostProsessor.h ├── PreProsessor │ └── PreProsessor.h └── UI │ ├── Document_Request_Type.h │ ├── Producer.h │ ├── Safe.h │ ├── Satellite.h │ ├── Service.h │ └── Usr.h ├── IO ├── Test.e.asm ├── Test.e.dll ├── Test_big.e ├── _asm.h ├── boost.e ├── general.h ├── gl.e └── test.e ├── LICENSE ├── Linkers ├── arm_ld.exe └── x86_ld.exe ├── Makefile ├── README.md ├── Tests ├── Cpp │ ├── Base.cpp │ ├── Test_Back_End.cpp │ └── Test_Lexer.cpp ├── H │ ├── Base.h │ ├── Test_Back_End.h │ └── Test_Lexer.h ├── IO │ ├── Array.e │ ├── Array.e.asm │ ├── Cast.e │ ├── Cast.e.asm │ ├── Comment.e │ ├── Conditions.e │ ├── Conditions.e.asm │ ├── Destructor.e │ ├── Func.e │ ├── Func.e.asm │ ├── Global.e │ ├── Global.e.asm │ ├── Math.e │ ├── Math.e.asm │ ├── NameSpace.e │ ├── NameSpace.e.asm │ ├── Operator_Overload.e │ ├── Ptr.e │ ├── Ptr.e.asm │ ├── Template.e │ ├── Template.e.asm │ ├── Type.e │ ├── Type.e.asm │ └── destructor.e.asm └── Unit_Tests.cpp └── _compile_commands.json /.Chached_Env_Paths.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gabidal/Evie_Old/f9d187c246f566201b41dfada582df3b18a108c3/.Chached_Env_Paths.txt -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | 1.) Gimme the Source file(s) please. 15 | 2.) Also Gimme the Generated Assembly file. 16 | 17 | **Expected behavior** 18 | A clear and concise description of what you expected to happen. 19 | 20 | **Screenshots** 21 | If applicable, add screenshots to help explain your problem. 22 | 23 | **Desktop (please complete the following information):** 24 | - OS: [e.g. iOS] 25 | - Version [e.g. 22] 26 | 27 | **Additional context** 28 | Add any other context about the problem here. 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | GAS.vcxproj 2 | GAS.vcxproj.filters 3 | GAS.vcxproj.user 4 | Release 5 | Debug 6 | Evie.pdb 7 | x64/Test 8 | CMakeFiles 9 | CMakeCache.txt 10 | cmake_install.cmake 11 | out 12 | .vs 13 | !.vs/launch.vs.json 14 | IO/test 15 | IO/test.asm.ThisIsTotallyExecutable 16 | IO/test.asm.exe 17 | IO/test.asm.exp 18 | IO/test.asm.lib 19 | IO/test.asm.obj 20 | IO/test.asm.pdb 21 | Evie 22 | 23 | Tests/IO/Remote 24 | IO/Remote 25 | 26 | enc_temp_folder 27 | 28 | .tmp.drivedownload 29 | .tmp.driveupload 30 | 31 | _compile_commands.json 32 | 33 | 34 | *.bin 35 | *.obj 36 | *.exe 37 | *.lib 38 | *.exp 39 | *.ilk 40 | *.pdb 41 | *.dll 42 | 43 | $null 44 | 45 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Debuggarna", 6 | "type": "cppvsdbg", 7 | "request": "launch", 8 | "program": "${workspaceFolder}/Evie.exe", 9 | "args": [ 10 | "-in", 11 | "${workspaceFolder}/Tests\\IO\\Template.e", 12 | "-f", 13 | "obj", 14 | "-reference-count-size", 15 | "0" 16 | ], 17 | "stopAtEntry": false, 18 | "cwd": "${workspaceFolder}", 19 | "environment": [], 20 | "externalConsole": false, 21 | "preLaunchTask": "Buildarna", 22 | "requireExactSource": false 23 | } 24 | ] 25 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "iostream": "cpp", 4 | "filesystem": "cpp", 5 | "map": "cpp", 6 | "vector": "cpp", 7 | "format": "cpp", 8 | "xstring": "cpp", 9 | "*.rh": "cpp", 10 | "utility": "cpp", 11 | "unordered_set": "cpp", 12 | "xhash": "cpp", 13 | "array": "cpp", 14 | "chrono": "cpp", 15 | "forward_list": "cpp", 16 | "initializer_list": "cpp", 17 | "list": "cpp", 18 | "regex": "cpp", 19 | "xtree": "cpp", 20 | "xutility": "cpp", 21 | "iosfwd": "cpp", 22 | "xlocale": "cpp", 23 | "xiosbase": "cpp", 24 | "functional": "cpp", 25 | "charconv": "cpp", 26 | "xlocnum": "cpp", 27 | "string": "cpp", 28 | "cmath": "cpp", 29 | "algorithm": "cpp", 30 | "atomic": "cpp", 31 | "bit": "cpp", 32 | "cctype": "cpp", 33 | "clocale": "cpp", 34 | "compare": "cpp", 35 | "concepts": "cpp", 36 | "condition_variable": "cpp", 37 | "cstddef": "cpp", 38 | "cstdint": "cpp", 39 | "cstdio": "cpp", 40 | "cstdlib": "cpp", 41 | "cstring": "cpp", 42 | "ctime": "cpp", 43 | "cwchar": "cpp", 44 | "exception": "cpp", 45 | "fstream": "cpp", 46 | "iomanip": "cpp", 47 | "ios": "cpp", 48 | "istream": "cpp", 49 | "iterator": "cpp", 50 | "limits": "cpp", 51 | "locale": "cpp", 52 | "memory": "cpp", 53 | "mutex": "cpp", 54 | "new": "cpp", 55 | "optional": "cpp", 56 | "ostream": "cpp", 57 | "ratio": "cpp", 58 | "shared_mutex": "cpp", 59 | "sstream": "cpp", 60 | "stdexcept": "cpp", 61 | "stop_token": "cpp", 62 | "streambuf": "cpp", 63 | "system_error": "cpp", 64 | "thread": "cpp", 65 | "tuple": "cpp", 66 | "type_traits": "cpp", 67 | "typeinfo": "cpp", 68 | "unordered_map": "cpp", 69 | "xfacet": "cpp", 70 | "xlocbuf": "cpp", 71 | "xlocinfo": "cpp", 72 | "xlocmes": "cpp", 73 | "xlocmon": "cpp", 74 | "xloctime": "cpp", 75 | "xmemory": "cpp", 76 | "xstddef": "cpp", 77 | "xtr1common": "cpp" 78 | }, 79 | "cSpell.words": [ 80 | "Evie" 81 | ] 82 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "tasks": [ 3 | { 4 | "type": "cppbuild", 5 | "label": "Buildarna", 6 | "command": "msbuild.exe", 7 | "args": [ 8 | "Evie.sln", 9 | "/p:Configuration=Test", 10 | //"/t:Rebuild", 11 | ], 12 | "options": { 13 | "cwd": "${workspaceFolder}" 14 | }, 15 | "problemMatcher": [ 16 | "$msCompile", 17 | { 18 | "fileLocation": "autoDetect", 19 | "pattern": { 20 | "regexp": "^([^\\s].*)\\s*:\\s+(?:fatal\\s+)?(error|warning)\\s+(LNK\\d+)\\s*:\\s*(.*)\\[(.*)\\]$", 21 | "kind": "file", 22 | "severity": 2, 23 | "code": 3, 24 | "message": 4, 25 | "file": 5 26 | } 27 | } 28 | ], 29 | "group": "build", 30 | "detail": "Buildarna" 31 | } 32 | ], 33 | "version": "2.0.0" 34 | } -------------------------------------------------------------------------------- /Assemblers/arm_as.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gabidal/Evie_Old/f9d187c246f566201b41dfada582df3b18a108c3/Assemblers/arm_as.exe -------------------------------------------------------------------------------- /Assemblers/x86_as.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gabidal/Evie_Old/f9d187c246f566201b41dfada582df3b18a108c3/Assemblers/x86_as.exe -------------------------------------------------------------------------------- /CMakeLists.txt.DEPRICATED: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | project(Evie) 3 | 4 | # Source files: 5 | FILE(GLOB root Cpp/*.cpp) 6 | FILE(GLOB Back_End Cpp/BackEnd/*.cpp) 7 | FILE(GLOB Docker Cpp/Docker/*.cpp) 8 | FILE(GLOB Lexer Cpp/Lexer/*.cpp) 9 | FILE(GLOB Nodes Cpp/Nodes/*.cpp) 10 | FILE(GLOB Parser Cpp/Parser/*.cpp) 11 | FILE(GLOB Pre Cpp/PreProsessor/*.cpp) 12 | FILE(GLOB UI Cpp/UI/*.cpp) 13 | 14 | 15 | FILE(GLOB Suite Tests/*.cpp) 16 | FILE(GLOB Tests Tests/Cpp/*.cpp) 17 | 18 | 19 | # Add source files 20 | add_executable(${PROJECT_NAME} 21 | ${root} 22 | ${Back_End} 23 | ${Docker} 24 | ${Lexer} 25 | ${Nodes} 26 | ${Parser} 27 | ${Pre} 28 | ${UI} 29 | 30 | ${Suite} 31 | ${Tests} 32 | ) 33 | 34 | set(CMAKE_CXX_STANDARD 17) 35 | set(CMAKE_CXX_STANDARD_REQUIRED True) 36 | set(CMAKE_BUILD_TYPE Debug) 37 | target_compile_options(${PROJECT_NAME} PRIVATE) 38 | set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17) -------------------------------------------------------------------------------- /CMakeSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com//fwlink//?linkid=834763 for more information about this file. 3 | "configurations": [ 4 | { 5 | "name": "x64-Debug", 6 | "generator": "Ninja", 7 | "configurationType": "Debug", 8 | "inheritEnvironments": [ "msvc_x64_x64" ], 9 | "buildRoot": "${projectDir}\\out\\build\\${name}", 10 | "installRoot": "${projectDir}\\out\\install\\${name}", 11 | "cmakeCommandArgs": "", 12 | "buildCommandArgs": "", 13 | "ctestCommandArgs": "" 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /Cpp/BackEnd/BackEnd.cpp: -------------------------------------------------------------------------------- 1 | #include "../../H/BackEnd/BackEnd.h" 2 | 3 | extern Node* Global_Scope; 4 | extern Usr* sys; 5 | extern x86_64 X86_64; 6 | extern ARM_64 _ARM_64; 7 | extern Selector* selector; 8 | 9 | void BackEnd::Init() 10 | { 11 | if (sys->Info.Architecture == "x86") { 12 | if (sys->Info.Bytes_Mode == "8") { 13 | Seperator = X86_64.Seperator; 14 | Register_Pre_Fix = X86_64.Register_Pre_Fix; 15 | Number_Pre_Fix = X86_64.Number_Pre_Fix; 16 | Label_Post_Fix = X86_64.Label_Post_Fix; 17 | } 18 | 19 | } 20 | else if (sys->Info.Architecture == "arm") { 21 | if (sys->Info.Bytes_Mode == "8") { 22 | if (sys->Info.OS == "win" || sys->Info.OS == "unix") { 23 | Seperator = _ARM_64.Seperator; 24 | Register_Pre_Fix = _ARM_64.Register_Pre_Fix; 25 | Number_Pre_Fix = _ARM_64.Number_Pre_Fix; 26 | Label_Post_Fix = _ARM_64.Label_Post_Fix; 27 | } 28 | } 29 | 30 | } 31 | } 32 | 33 | void BackEnd::Factory() 34 | { 35 | int j = 0; 36 | for (auto i : Input) { 37 | Label_Builder(i); 38 | Global_Builder(i); 39 | Operator_Builder(i); 40 | End_Of_Function_Builder(i); 41 | Call_Builder(i); 42 | j++; 43 | } 44 | } 45 | 46 | void BackEnd::Operator_Builder(IR* i) 47 | { 48 | //leave data handling into other algorithm 49 | if (!i->is(TOKEN::OPERATOR) && !i->is(TOKEN::FLOW) && !i->is(TOKEN::SET_DATA)) 50 | return; 51 | 52 | string Result = ""; 53 | 54 | //get the needed opcode 55 | IR* opc = selector->Get_Opcode(i); 56 | Result += opc->OPCODE->Get_Name() + " "; 57 | 58 | //set up the parameters 59 | for (int p = 0; p < i->Arguments.size(); p++) { 60 | Result += Token_Builder(i->Arguments[p], i->is(TOKEN::SET_DATA)); 61 | if ((size_t)p + 1 < i->Arguments.size()) { 62 | Result += Seperator + " "; 63 | } 64 | } 65 | 66 | *Output += Result; 67 | 68 | 69 | int Comment_Distance = 60 - Result.size(); 70 | 71 | string Comment = ""; 72 | 73 | for (int j = 0; j < Comment_Distance; j++) 74 | Comment += " "; 75 | 76 | Comment += "#"; 77 | 78 | for (int j = 0; j < i->Arguments.size(); j++) { 79 | Comment += i->Arguments[j]->Get_Name(); 80 | if (j != i->Arguments.size() - 1) 81 | Comment += ", "; 82 | } 83 | 84 | *Output += Comment + "\n"; 85 | } 86 | 87 | void BackEnd::Label_Builder(IR* i) 88 | { 89 | if (!i->is(TOKEN::LABEL)) 90 | return; 91 | 92 | *Output += i->OPCODE->Get_Name() + Label_Post_Fix + "\n"; 93 | } 94 | 95 | void BackEnd::End_Of_Function_Builder(IR* i) 96 | { 97 | if (!i->is(TOKEN::END_OF_FUNCTION)) 98 | return; 99 | 100 | *Output += "\n\n"; 101 | } 102 | 103 | void BackEnd::Call_Builder(IR* i) 104 | { 105 | if (!i->is(TOKEN::CALL)) 106 | return; 107 | 108 | IR* call_opc = selector->Get_Opcode(i); 109 | *Output += call_opc->OPCODE->Get_Name(); 110 | 111 | *Output += " " + Token_Builder(i->Arguments[0]) + "\n"; 112 | } 113 | 114 | void BackEnd::Global_Builder(IR* i) 115 | { 116 | if (!i->is(TOKEN::GLOBAL_LABEL)) 117 | return; 118 | 119 | IR* glob = selector->Get_Opcode(i); 120 | *Output += glob->OPCODE->Get_Name(); 121 | 122 | *Output += " " + Token_Builder(i->Arguments[0]) + "\n"; 123 | } 124 | 125 | string BackEnd::Token_Builder(Token* t, bool Inside_Content) 126 | { 127 | string PreFix = ""; 128 | string PostFix = ""; 129 | string Result = ""; 130 | string Name = ""; 131 | if (t->is(TOKEN::REGISTER) || t->is(TOKEN::NONVOLATILE) || t->is(TOKEN::RETURNING) || t->is(TOKEN::QUOTIENT) || t->is(TOKEN::REMAINDER) || t->is(TOKEN::PARAMETER)) { 132 | Name = t->ID->Name; 133 | } 134 | else if (t->is(TOKEN::NUM) || (t->is(TOKEN::DECIMAL) && !t->is(TOKEN::MEMORY))) { 135 | //if (Inside_Content) 136 | Name = t->Get_Name(); 137 | //else 138 | // Name = selector->Get_Size_Identifier(t->Get_Size()) + " " + t->Get_Name(); 139 | } 140 | else if (t->is(TOKEN::STRING)) 141 | Name = "\"" + t->Get_Name() + "\""; 142 | else if (t->is(TOKEN::GLOBAL_VARIABLE)) 143 | //Name = selector->Get_Size_Identifier(t->Get_Size()) + "[" + t->Get_Name() + "]"; 144 | Name = t->Get_Name(); 145 | else if (t->is(TOKEN::MEMORY)) { 146 | if (Inside_Content) 147 | PreFix = t->Get_Name(); 148 | else 149 | PreFix = selector->Get_Size_Identifier(t->Get_Size()) + " ["; 150 | for (auto i : t->Childs) 151 | Name += Token_Builder(i, true) + " "; 152 | PostFix = "]"; 153 | } 154 | else if (t->is(TOKEN::CONTENT)) { 155 | PreFix = "("; 156 | for (auto i : t->Childs) 157 | Name += Token_Builder(i, true); 158 | PostFix = ")"; 159 | } 160 | else if (t->is(TOKEN::OFFSETTER) || t->is(TOKEN::SCALER) || t->is(TOKEN::DEOFFSETTER)) { 161 | Name += Token_Builder(t->Left, true) + " " + t->Get_Name() + " " + Token_Builder(t->Right, true); 162 | } 163 | else if (t->is(TOKEN::LABEL)) 164 | Name = t->Get_Name(); 165 | 166 | Result = PreFix + Name + PostFix; 167 | return Result; 168 | } 169 | -------------------------------------------------------------------------------- /Cpp/BackEnd/IROptimizer.cpp: -------------------------------------------------------------------------------- 1 | #include "../../H/BackEnd/IROptimizer.h" 2 | 3 | void IROptimizer::Factory(){ 4 | 5 | for (int i = 0; i < Input.size(); i++){ 6 | for (auto& arg : Input[i]->Arguments){ 7 | Combine_Scale_And_Offset_In_Memory(arg); 8 | } 9 | } 10 | 11 | 12 | } 13 | 14 | // [(((reg + reg) + 123) * 4)] 15 | // -> 16 | // {reg, +, reg, +, 123, *, 4} 17 | vector IROptimizer::Liquify_MEM_AST(Token* t){ 18 | vector Result; 19 | 20 | if (t->Any(TOKEN::SCALER | TOKEN::OFFSETTER | TOKEN::DEOFFSETTER)){ 21 | vector tmp = Liquify_MEM_AST(t->Left); 22 | 23 | // Add the left side of the operator. 24 | Result.insert(Result.end(), tmp.begin(), tmp.end()); 25 | 26 | // add itself to the center 27 | Result.push_back(t); 28 | 29 | tmp = Liquify_MEM_AST(t->Right); 30 | 31 | // add the right side right after the centre. 32 | Result.insert(Result.end(), tmp.begin(), tmp.end()); 33 | } 34 | // Open the paranthesis. e.g: TOKEN::CONTENT. 35 | else if (t->Childs.size() > 0){ 36 | vector tmp; 37 | 38 | for (auto& c : t->Childs){ 39 | tmp = Liquify_MEM_AST(c); 40 | Result.insert(Result.end(), tmp.begin(), tmp.end()); 41 | } 42 | } 43 | //Paranthesis wont have it's own place in the liquid list. 44 | else{ 45 | Result.push_back(t); 46 | } 47 | 48 | return Result; 49 | } 50 | 51 | // This function finds spots where the operator sides can be switched whitout contaminating the equation. 52 | // {213, +, reg, +, 32, *, 4} 53 | // -> 54 | // {reg, +, 213, +, 32, *, 4} 55 | void IROptimizer::Switch_Operator_Sides(vector& liquid){ 56 | 57 | // {123, +, reg1, + 345, *, 2} 58 | // -> 59 | // {reg1, +, 123, + 345, *, 2} 60 | 61 | vector Movables; 62 | 63 | Movables.resize(liquid.size(), true); 64 | 65 | // First asses the liquided tokens that cannot be switched, this can occur either when the operator between the current tokens 66 | // Is either a * or -. 67 | for (int Current = 0; Current < liquid.size(); Current++){ 68 | if (liquid[Current]->Any(TOKEN::DEOFFSETTER | TOKEN::SCALER)){ 69 | for (int i = Current - 1; i < Current + 1; i++){ 70 | Movables[i] = false; 71 | } 72 | } 73 | } 74 | 75 | // Now we can go and check if there are any movable numbers that can be switched to be more closer to another numbers. 76 | for (int i = 0; i < liquid.size(); i++){ 77 | 78 | int Left = i-1; 79 | int Right = i+1; 80 | 81 | int Right_Operator = Right + 1; 82 | int Right_Operator_Right_Side = Right_Operator + 1; 83 | 84 | if (liquid[i]->Any(TOKEN::OFFSETTER)){ 85 | 86 | if (liquid[Left]->Any(TOKEN::NUM) && !liquid[Right]->Any(TOKEN::NUM) && Movables[Right]){ 87 | // {13, +, reg} 88 | 89 | //check if the right side of this operator could have a number 90 | // {13, +, reg, +, 2} 91 | // The right side operator cannot be any other operator other than +, because - and * are not movables, 92 | // and thus the right side of this poerator should also have been immovable. 93 | if (liquid[Right_Operator_Right_Side]->Any(TOKEN::NUM)){ 94 | // Now we can switch this left side with this right side. 95 | Switch_Sides(liquid, Left, Right); 96 | } 97 | } 98 | } 99 | } 100 | } 101 | 102 | // {l, +, r, +, 123} 103 | // -> 104 | // {r, +, l, +, 123} 105 | void IROptimizer::Switch_Sides(vector& liquid, int l, int r){ 106 | 107 | Token Left_Tmp = *liquid[l]; 108 | 109 | Token Right_Tmp = *liquid[r]; 110 | 111 | *liquid[l] = Right_Tmp; 112 | *liquid[r] = Left_Tmp; 113 | 114 | // Now also setup the parents and other AST information. 115 | liquid[l]->Left = Left_Tmp.Left; 116 | liquid[l]->Right = Left_Tmp.Right; 117 | 118 | liquid[l]->Parent = Left_Tmp.Parent; 119 | liquid[l]->Childs = Left_Tmp.Childs; 120 | 121 | liquid[r]->Left = Right_Tmp.Left; 122 | liquid[r]->Right = Right_Tmp.Right; 123 | 124 | liquid[r]->Parent = Right_Tmp.Parent; 125 | liquid[r]->Childs = Right_Tmp.Childs; 126 | } 127 | 128 | // [reg + 0 * 4] 129 | // -> 130 | // [reg] 131 | void IROptimizer::Combine_Scale_And_Offset_In_Memory(Token* mem){ 132 | if (!mem->Any(TOKEN::MEMORY)) 133 | return; 134 | 135 | vector Liquid_List = Liquify_MEM_AST(mem); 136 | 137 | // Make sure that the operator sides coside with eachother. 138 | Switch_Operator_Sides(Liquid_List); 139 | 140 | for (int opc = 0; opc < Liquid_List.size(); opc++){ 141 | if (!Liquid_List[opc]->Any(TOKEN::OFFSETTER | TOKEN::SCALER | TOKEN::DEOFFSETTER)) 142 | continue; 143 | 144 | //chekc if the bith sides are numbers. 145 | int Left = opc - 1; 146 | int Right = opc + 1; 147 | 148 | if (!Liquid_List[Left]->Any(TOKEN::NUM) || !Liquid_List[Right]->Any(TOKEN::NUM)) 149 | continue; 150 | 151 | // Now we can combine the two numbers. 152 | int Left_Num = stoi(Liquid_List[Left]->Name); 153 | int Right_Num = stoi(Liquid_List[Right]->Name); 154 | 155 | int Result = 0; 156 | 157 | if (Liquid_List[opc]->Any(TOKEN::OFFSETTER)){ 158 | Result = Left_Num + Right_Num; 159 | } 160 | else if (Liquid_List[opc]->Any(TOKEN::SCALER)){ 161 | Result = Left_Num * Right_Num; 162 | } 163 | else if (Liquid_List[opc]->Any(TOKEN::DEOFFSETTER)){ 164 | Result = Left_Num - Right_Num; 165 | } 166 | 167 | // Now we can replace the three tokens with one. 168 | // because the operator is always the gateway to the right and left side, thus the operator is where wew will replace this result. 169 | Token opc_tmp = *Liquid_List[opc]; 170 | 171 | *Liquid_List[opc] = *Liquid_List[Left]; 172 | 173 | Liquid_List[opc]->Name = to_string(Result); 174 | 175 | // {(reg, + 12), +, 243} 176 | // -> 177 | // {reg, +, 265} 178 | 179 | // Also if the opc has a another operator on it's left or right side. 180 | if (opc_tmp.Left->Any(TOKEN::OFFSETTER | TOKEN::DEOFFSETTER | TOKEN::SCALER)){ 181 | Token* New_Parent = opc_tmp.Left; 182 | 183 | *New_Parent->Right = *Liquid_List[opc]; 184 | 185 | *Liquid_List[opc] = *New_Parent; 186 | } 187 | 188 | if (opc_tmp.Right->Any(TOKEN::OFFSETTER | TOKEN::DEOFFSETTER | TOKEN::SCALER)){ 189 | Token* New_Parent = opc_tmp.Right; 190 | 191 | *New_Parent->Left = *Liquid_List[opc]; 192 | 193 | *Liquid_List[opc] = *New_Parent; 194 | } 195 | } 196 | } -------------------------------------------------------------------------------- /Cpp/Docker/ASM.cpp: -------------------------------------------------------------------------------- 1 | #include "../../H/Docker/ASM.h" 2 | #include "../../H/UI/Safe.h" 3 | 4 | void ASM::ASM_Analyzer(vector& Output) 5 | { 6 | //here we will just make an prototype from every label. Parser can analyse wich one is a function, and what is not. 7 | //and after that we want to give Evie Core the "use "filename"" without the preprosessor so that Evie Core can implement an 8 | //post-prosessing include 9 | vector Header_Data = DOCKER::Get_Header(DOCKER::FileName.back()); 10 | if (Header_Data.size() < 1) 11 | Header_Data = DOCKER::Get_Header("asm..e"); 12 | if (Header_Data.size() < 1) 13 | Header_Data = DOCKER::Default_ASM_Header_Data; 14 | if (Header_Data.size() < 1) 15 | Report(Observation(ERROR, "Docker didn't find Header file for " + DOCKER::FileName.back(), Position())); 16 | //DOCKER::Separate_Identification_Patterns(Header_Data); 17 | vector tmp; 18 | if (DOCKER::Buffer) { 19 | tmp = vector(DOCKER::Buffer, DOCKER::Buffer + DOCKER::Buffer_Size); 20 | } 21 | else { 22 | tmp = DOCKER::Get_Char_Buffer_From_File(DOCKER::FileName.back(), DOCKER::Working_Dir.back().second); 23 | } 24 | string buffer = string((char*)tmp.data(), tmp.size()); 25 | Section Function_Section = DOCKER::Get_Section_From_String(buffer); 26 | 27 | string Tmp = string((char*)Function_Section.start, Function_Section.size); 28 | auto Types = DOCKER::Separate_Identification_Patterns(Header_Data); 29 | vector> Raw_Data = DOCKER::Get_Names_Of(Tmp, Types); 30 | for (auto& i : Raw_Data) { 31 | if (i.second.find(".global ") != -1) 32 | i.second.erase(i.second.find(".global "), 8); 33 | 34 | if (i.second.find("global ") != -1) 35 | i.second.erase(i.second.find("global "), 7); 36 | } 37 | DOCKER::Append(Output, Raw_Data); 38 | // 39 | //Syntax_Correcter(Raw_Data); 40 | //now make the obj token for YASM 41 | DOCKER::Assembly_Source_File.push_back(DOCKER::Working_Dir.back().second + DOCKER::FileName.back()); 42 | return; 43 | } 44 | -------------------------------------------------------------------------------- /Cpp/Docker/LIB.cpp: -------------------------------------------------------------------------------- 1 | #include "../../H/Docker/LIB.h" 2 | #include "../../H/UI/Safe.h" 3 | 4 | extern Usr* sys; 5 | 6 | void LIB::Generate_Binary_Symbols(string filename, string WD) 7 | { 8 | string NM_Posix = ""; 9 | //first start the NM.exe 10 | if (sys->Info.HOST_OS == "win32") 11 | NM_Posix = "nm.exe "; 12 | else 13 | NM_Posix = "./nm "; 14 | 15 | system((NM_Posix + WD + filename + " --extern-only --defined-only -P > .TMP.txt").c_str()); 16 | return; 17 | } 18 | 19 | pair> LIB::Read_AR_File(string filename){ 20 | vector Result; 21 | vector tmp = DOCKER::Get_Char_Buffer_From_File(filename, ""); 22 | 23 | vector Data; 24 | 25 | const int SKIP_MAGIC_NUMBER = 8; 26 | const int SKIP_CURRENT_PACKET_INFO = 60; 27 | 28 | try { 29 | for (int i = SKIP_MAGIC_NUMBER; i < tmp.size();) { 30 | Packet p; 31 | p.Info = *(decltype(p.Info)*)tmp.data(); 32 | 33 | p.Buffer = new char[DOCKER::Initialize_Number(p.Info.File_Size)]; 34 | memcpy(p.Buffer, tmp.data(), DOCKER::Initialize_Number(p.Info.File_Size)); 35 | 36 | i += SKIP_CURRENT_PACKET_INFO + DOCKER::Initialize_Number(p.Info.File_Size); 37 | Data.push_back(p); 38 | } 39 | } 40 | catch (...) { 41 | return { false, {} }; 42 | } 43 | 44 | return { true, Data }; 45 | } 46 | 47 | pair> LIB::Read_LIB_File(string filename) 48 | { 49 | return { false, {} }; 50 | } 51 | 52 | void LIB::LIB_Analyzer(vector& Output) 53 | { 54 | vector Header_Data = DOCKER::Get_Header(DOCKER::FileName.back()); 55 | if (Header_Data.size() < 1) 56 | Header_Data = DOCKER::Get_Header("lib..e"); 57 | if (Header_Data.size() < 1) 58 | Header_Data = DOCKER::Default_Header_Data; 59 | if (Header_Data.size() < 1) 60 | Report(Observation(ERROR, "Docker didn't find Header file for " + DOCKER::FileName.back(), Position())); 61 | 62 | ////write the lib with nm to .TMP.txt file 63 | //LIB::Generate_Binary_Symbols(DOCKER::FileName.back(), DOCKER::Working_Dir.back().second); 64 | //vector tmp = DOCKER::Get_Char_Buffer_From_File(".TMP.txt", ""); 65 | //string buffer = string((char*)tmp.data(), tmp.size()); 66 | ////use filtters 67 | //buffer = DOCKER::ReplaceAll(buffer, "\r\n", "\n"); 68 | //regex filtter("(\\?.*)|(\\ .\\ [0-9]+)|(.+:)|(__.+@.+)"); 69 | //buffer = regex_replace(buffer, filtter, ""); 70 | //regex filtter2("(\\n{2,})"); 71 | //buffer = regex_replace(buffer, filtter2, "\n"); 72 | //Section Function_Section = DOCKER::Get_Section_From_String(buffer); 73 | //for (int i = 0; i < Function_Section.size; i++) { 74 | // if (Function_Section.start[i] == '\0') 75 | // Function_Section.start[i] = '?'; 76 | //} 77 | //string Tmp = string((char*)Function_Section.start, Function_Section.size); 78 | //DOCKER::Append(Output, DOCKER::Get_Names_Of(Tmp, DOCKER::Separate_Identification_Patterns(Header_Data))); 79 | //DOCKER::Libs.push_back(DOCKER::Working_Dir.back().second + DOCKER::FileName.back()); 80 | 81 | pair> Data = Read_AR_File(DOCKER::Working_Dir.back().second + DOCKER::FileName.back()); 82 | 83 | if (!Data.first) { 84 | Data = Read_LIB_File(DOCKER::Working_Dir.back().second + DOCKER::FileName.back()); 85 | } 86 | 87 | if (!Data.first) 88 | Report(Observation(ERROR, "Cannot parse file: '" + DOCKER::Working_Dir.back().second + DOCKER::FileName.back() + "'")); 89 | 90 | for (auto &i : Data.second) { 91 | Docker d(i.Info.File_Indentifier, i.Buffer, DOCKER::Initialize_Number(i.Info.File_Size)); 92 | } 93 | 94 | return; 95 | } 96 | -------------------------------------------------------------------------------- /Cpp/Docker/TXT.cpp: -------------------------------------------------------------------------------- 1 | #include "../../H/Docker/TXT.h" 2 | 3 | void TXT::TXT_Analyzer(vector& Output) 4 | { 5 | ifstream file(DOCKER::Working_Dir.back().second + DOCKER::FileName.back(), std::ios::binary); 6 | 7 | if (!file.is_open()) { 8 | throw::runtime_error("FILE NOT FOUND!"); 9 | } 10 | file.seekg(0, ios_base::end); 11 | long long size = file.tellg(); 12 | char* Buffer = new char[size + 1]; 13 | file.seekg(0, ios_base::beg); 14 | file.read(Buffer, size); 15 | Buffer[size] = '\0'; 16 | file.close(); 17 | Output.push_back(string(Buffer)); 18 | return; 19 | } 20 | 21 | vector TXT::Unwrap(string raw) 22 | { 23 | vector Result; 24 | for (auto i : Lexer::GetComponents(raw)) { 25 | Result.push_back(i.Value); 26 | } 27 | return Result; 28 | } 29 | -------------------------------------------------------------------------------- /Cpp/Lexer/Component.cpp: -------------------------------------------------------------------------------- 1 | #include "../../H/Lexer/Component.h" 2 | #include "../../H/Lexer/Lexer.h" 3 | #include "../../H/Nodes/Node.h" 4 | 5 | Component* Component::Copy_Component() { 6 | Component* Result = new Component(*this); 7 | 8 | if (Result->node) 9 | Result->node->Copy_Node(Result->node, Result->node, Result->node->Scope); 10 | 11 | for (auto& i : Result->Components) 12 | i = *i.Copy_Component(); 13 | 14 | return Result; 15 | } -------------------------------------------------------------------------------- /Cpp/Lexer/Position.cpp: -------------------------------------------------------------------------------- 1 | #include "../../H/Lexer/Position.h" 2 | #include 3 | #include 4 | 5 | #include "../../H/Docker/Docker.h" 6 | 7 | using namespace std; 8 | 9 | string* FileName = new string("No File"); 10 | 11 | Position::Position(int line, int character, int local, int absolute) 12 | { 13 | Line = line; 14 | Character = character; 15 | Local = local; 16 | Absolute = absolute; 17 | File_Name = FileName->c_str(); 18 | } 19 | 20 | int Position::GetFileIndex() 21 | { 22 | for (int i = 0; i < DOCKER::Included_Files.size(); i++) 23 | if (DOCKER::Included_Files[i] == File_Name) 24 | return i; 25 | } 26 | -------------------------------------------------------------------------------- /Cpp/Nodes/Token.cpp: -------------------------------------------------------------------------------- 1 | #include "../../H/Nodes/Token.h" 2 | #include "../../H/BackEnd/Selector.h" 3 | #include "../../H/UI/Usr.h" 4 | #include "../../H/UI/Safe.h" 5 | #include "../../H/Docker/Mangler.h" 6 | 7 | #include "../../H/Assembler/Assembler_Types.h" 8 | 9 | extern Selector* selector; 10 | extern Usr* sys; 11 | 12 | Token::Token(Node* n, bool Skip_Needed_Address_Protocol) { 13 | if (n->is(OBJECT_NODE) || n->is(OBJECT_DEFINTION_NODE)) { 14 | if (n->Find(n, n->Scope)->Scope->is("static") || n->is("static") || (n->Fetcher && n->Fetcher->is("static")) || n->Find(n, n->Scope)->Has({FUNCTION_NODE, PROTOTYPE, IMPORT, EXPORT})) 15 | Flags = TOKEN::GLOBAL_VARIABLE | TOKEN::CONTENT; 16 | else if (n->Find(n, n->Scope)->Requires_Address) 17 | Flags = TOKEN::CONTENT; 18 | else 19 | Flags = TOKEN::REGISTER; 20 | 21 | if (n->Find(n, n)->Format == "decimal") 22 | Flags |= TOKEN::DECIMAL; 23 | } 24 | else if (n->is(NUMBER_NODE)) { 25 | Flags = TOKEN::NUM; 26 | if (n->Format == "decimal") { 27 | Flags |= TOKEN::DECIMAL; 28 | Has_Floating_Point_Value = true; 29 | } 30 | //This not needed anymore, because Algebra does this nowdays. 31 | /*if (n->Coefficient == -1) 32 | n->Name = "-" + n->Name;*/ 33 | } 34 | else if (n->is(PARAMETER_NODE)) { 35 | //first get the index this paremet is 36 | int Max_Integer_Registers = selector->Get_Numerical_Parameter_Register_Count(n->Get_Scope_As(FUNCTION_NODE, n->Scope)->Parameters); 37 | int Current_Integer_Register_Count = 0; 38 | int Max_Floating_Registers = selector->Get_Floating_Parameter_Register_Count(n->Get_Scope_As(FUNCTION_NODE, n->Scope)->Parameters); 39 | int Current_Float_Register_Count = 0; 40 | 41 | bool Requires_Address = n->Find(n, n->Scope)->Requires_Address && !Skip_Needed_Address_Protocol; 42 | 43 | //find the curresponding register 44 | for (int i = 0; i < n->Get_Scope_As(FUNCTION_NODE, n->Scope)->Parameters.size(); i++) { 45 | if (n->Get_Scope_As(FUNCTION_NODE, n->Scope)->Parameters[i]->Name == n->Name) { 46 | if (n->Get_Scope_As(FUNCTION_NODE, n->Scope)->Parameters[i]->Format == "decimal") { 47 | if (Current_Float_Register_Count < Max_Floating_Registers && !Requires_Address) { 48 | Flags = TOKEN::REGISTER | TOKEN::DECIMAL | TOKEN::PARAMETER; 49 | Parameter_Index = i; 50 | } 51 | else 52 | Flags = TOKEN::CONTENT | TOKEN::DECIMAL; 53 | break; 54 | } 55 | else { 56 | if (Current_Integer_Register_Count < Max_Integer_Registers && !Requires_Address) { 57 | Flags = TOKEN::REGISTER | TOKEN::PARAMETER; 58 | Parameter_Index = i; 59 | } 60 | else 61 | Flags = TOKEN::CONTENT; 62 | break; 63 | } 64 | } 65 | if (n->Get_Scope_As(FUNCTION_NODE, n->Scope)->Parameters[i]->Format == "decimal") 66 | Current_Float_Register_Count++; 67 | else 68 | Current_Integer_Register_Count++; 69 | } 70 | } 71 | else if (n->is(STRING_NODE)) 72 | Flags = TOKEN::STRING; 73 | else if (n->is(LABEL_NODE)) { 74 | Flags = TOKEN::LABEL; 75 | n->Size = _SYSTEM_BIT_SIZE_;//for giving the address 76 | } 77 | else 78 | return; 79 | Size = n->Find(n, n->Scope)->Size; 80 | 81 | Name = n->Name; 82 | 83 | if (n->is(NUMBER_NODE) && n->Format == "decimal") { 84 | double tmp = atof(n->Name.c_str()); 85 | 86 | Name = to_string(*(long long*)&tmp); 87 | } 88 | 89 | if (n->Find(n, n->Scope)->Has({ FUNCTION_NODE, IMPORT, EXPORT })) 90 | Name = MANGLER::Mangle(n->Function_Implementation, ""); 91 | 92 | if ((n->Find(n, n)->is("static"))) 93 | Name = MANGLER::Mangle(n, ""); 94 | 95 | Parent = n->Scope; 96 | 97 | if (Flags == 0) 98 | Report(Observation(ERROR, "Internal error! Missing Flag in token " + Name, Position())); 99 | } 100 | 101 | vector Token::Get_All(vector F) 102 | { 103 | vector Result; 104 | for (auto i : F) { 105 | vector Tmp = Get_All(i); 106 | Result.insert(Result.begin(), Tmp.begin(), Tmp.end()); 107 | } 108 | return Result; 109 | } 110 | 111 | vector Token::Get_All(long long F) 112 | { 113 | vector Result; 114 | for (auto i : Childs) { 115 | vector Tmp = i->Get_All(F); 116 | Result.insert(Result.begin(), Tmp.begin(), Tmp.end()); 117 | } 118 | for (auto i : Parameters) { 119 | vector Tmp = i->Get_All(F); 120 | Result.insert(Result.begin(), Tmp.begin(), Tmp.end()); 121 | } 122 | if (Left) { 123 | vector Tmp = Left->Get_All(F); 124 | Result.insert(Result.begin(), Tmp.begin(), Tmp.end()); 125 | } 126 | if (Right) { 127 | vector Tmp = Right->Get_All(F); 128 | Result.insert(Result.begin(), Tmp.begin(), Tmp.end()); 129 | } 130 | 131 | if (this->is(F)) 132 | Result.push_back(this); 133 | 134 | return Result; 135 | } 136 | 137 | vector Token::Get_All() 138 | { 139 | vector Result; 140 | for (auto i : Childs) { 141 | vector Tmp = i->Get_All(); 142 | Result.insert(Result.begin(), Tmp.begin(), Tmp.end()); 143 | } 144 | for (auto i : Parameters) { 145 | vector Tmp = i->Get_All(); 146 | Result.insert(Result.begin(), Tmp.begin(), Tmp.end()); 147 | } 148 | if (Left) { 149 | vector Tmp = Left->Get_All(); 150 | Result.insert(Result.begin(), Tmp.begin(), Tmp.end()); 151 | } 152 | if (Right) { 153 | vector Tmp = Right->Get_All(); 154 | Result.insert(Result.begin(), Tmp.begin(), Tmp.end()); 155 | } 156 | 157 | Result.push_back(this); 158 | 159 | return Result; 160 | } 161 | 162 | // void Token::Fix_Number_Size(){ 163 | // if (!is(TOKEN::NUM)) 164 | // return; 165 | 166 | // try { 167 | // Size = selector->Get_Bits_Size(stoll(Name)); 168 | // } 169 | // catch (...){} 170 | // } 171 | -------------------------------------------------------------------------------- /Cpp/Parser/Memory_Manager.cpp: -------------------------------------------------------------------------------- 1 | #include "../../H/Parser/Memory_Manager.h" 2 | #include "../../H/BackEnd/Selector.h" 3 | #include "../../H/Docker/Mangler.h" 4 | 5 | extern Selector* selector; 6 | 7 | 8 | void Memory_Manager::Factory() 9 | { 10 | Manage_Function(); 11 | Manage_Class_Padding(); 12 | } 13 | 14 | 15 | /// 16 | /// 17 | /// 18 | void Memory_Manager::Manage_Function() 19 | { 20 | if (!Scope->is(FUNCTION_NODE)) 21 | return; 22 | 23 | 24 | } 25 | 26 | /// 27 | /// Memory alignments managing. 28 | /// Tells how many bytes are recyclable because of memory padding. 29 | /// 30 | void Memory_Manager::Manage_Class_Padding() 31 | { 32 | if (!Scope->is(CLASS_NODE)) 33 | return; 34 | if (Scope->is(PARSED_BY::MEMORY::CLASS_MEMORY_PADDER)) 35 | return; 36 | 37 | if (MANGLER::Is_Base_Type(Scope)) 38 | return; 39 | 40 | //This memory padding is not applied to plain data structures 41 | if (!Scope->is("plain")) { 42 | //Try to compress memory usage, if the user agrees to it. 43 | Manage_Class_Re_Order(); 44 | 45 | const int BITS = selector->Get_Largest_Register_Size(); //<- this can be the maximun register size 46 | int Remainder = Scope->Size % BITS; 47 | 48 | Scope->Set(PARSED_BY::MEMORY::CLASS_MEMORY_PADDER); 49 | if (Remainder == 0) 50 | return; 51 | 52 | Report(Observation(INFO, "Added " + to_string(Remainder) + " bytes to the end of '" + Scope->Name + "'.", *Scope->Location)); 53 | 54 | //If the base class has already a padder, then modify it. 55 | Node* Padder = Scope->Find("__CLASS_MEMORY_PADDER__", Scope, OBJECT_DEFINTION_NODE, false); 56 | if (Padder) { 57 | Padder->Name = to_string(stoi(Padder->Name) + Remainder); 58 | } 59 | else { 60 | Padder = new Node(OBJECT_DEFINTION_NODE, Scope->Location); 61 | Padder->Name = "__CLASS_MEMORY_PADDER__"; 62 | //NOTE: const as inheritance may not negate re-sizing! 63 | Padder->Inheritted.push_back("internal"); 64 | Padder->Size = Remainder; 65 | Padder->Scope = Scope; 66 | 67 | Scope->Defined.push_back(Padder); 68 | } 69 | } 70 | } 71 | 72 | /// 73 | /// Gathers members of a class and re-orders them in size order. 74 | /// 75 | void Memory_Manager::Manage_Class_Re_Order() 76 | { 77 | if (!Scope->is(CLASS_NODE)) 78 | return; 79 | if (Scope->is(PARSED_BY::MEMORY::CLASS_RE_ORDERER)) 80 | return; 81 | 82 | //This system is only for Evie own structures. 83 | if (!Scope->Has({ (string)"evie", "vivid" })) 84 | return; 85 | 86 | Re_Order_Vector(Scope->Defined); 87 | 88 | Scope->Set(PARSED_BY::MEMORY::CLASS_RE_ORDERER); 89 | } 90 | 91 | 92 | // puts big at start and smoll at end :) 93 | void Memory_Manager::Re_Order_Vector(vector& List) 94 | { 95 | std::sort(List.begin(), List.end(), [](Node* a, Node* b) { return a->Size > b->Size; }); 96 | } 97 | -------------------------------------------------------------------------------- /Cpp/UI/Usr.cpp: -------------------------------------------------------------------------------- 1 | #include "../../H/UI/Usr.h" 2 | #include "../../H/Docker/Docker.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | //main -in ~/test.g -out ~/test.asm -os win32 -arch x86 -mode 32 9 | void Usr::Create_Argument_Stats() 10 | { 11 | Find_Evie_Executable_Position(); 12 | 13 | if (Argument_Amount == 2){ 14 | Single_Argument_Use(); 15 | } 16 | 17 | for (int i = 1; i < Argument_Amount; i++) { 18 | Find_Destination_File(i); 19 | Find_Source_File(i); 20 | Find_OS(i); 21 | Find_HOST_OS(i); 22 | Find_Architecture(i); 23 | Find_Bits_Mode(i); 24 | Find_Debug_Type(i); 25 | Find_Format(i); 26 | Find_Lib(i); 27 | Find_VT_API(i); 28 | Find_Service(i); 29 | Find_Reference_Count(i); 30 | } 31 | } 32 | 33 | void Usr::Find_Source_File(int &i) 34 | { 35 | if ((i <= Argument_Amount) && strcmp(Input[i], "-in") == 0) 36 | { 37 | Info.Source_File = Input[i + 1]; 38 | i++; 39 | } 40 | } 41 | 42 | void Usr::Find_Destination_File(int &i) 43 | { 44 | if ((i <= Argument_Amount) && strcmp(Input[i], "-out") == 0) 45 | { 46 | Info.Destination_File = Input[i + 1]; 47 | i++; 48 | } 49 | } 50 | 51 | void Usr::Find_OS(int &i) 52 | { 53 | if ((i <= Argument_Amount) && strcmp(Input[i], "-os") == 0) 54 | { 55 | Info.OS = Input[i + 1]; 56 | i++; 57 | } 58 | } 59 | 60 | void Usr::Find_HOST_OS(int& i) 61 | { 62 | if ((i <= Argument_Amount) && strcmp(Input[i], "-host") == 0) 63 | { 64 | Info.HOST_OS = Input[i + 1]; 65 | i++; 66 | } 67 | } 68 | 69 | void Usr::Find_Architecture(int &i) 70 | { 71 | if ((i <= Argument_Amount) && strcmp(Input[i], "-arch") == 0) 72 | { 73 | Info.Architecture = Input[i + 1]; 74 | i++; 75 | } 76 | } 77 | 78 | void Usr::Find_Bits_Mode(int &i) 79 | { 80 | if ((i <= Argument_Amount) && strcmp(Input[i], "-mode") == 0) 81 | { 82 | Info.Bytes_Mode = to_string(atoi(Input[i + 1]) / 8); 83 | i++; 84 | } 85 | } 86 | 87 | void Usr::Find_Format(int &i) 88 | { 89 | if ((i <= Argument_Amount) && strcmp(Input[i], "-f") == 0) 90 | { 91 | string tmp = string(Input[i + 1]); 92 | Info.Format = tmp.c_str(); 93 | i++; 94 | } 95 | } 96 | 97 | void Usr::Find_Lib(int& i) 98 | { 99 | if ((i <= Argument_Amount) && strcmp(Input[i], "-lib") == 0) 100 | { 101 | string tmp = string(Input[i + 1]); 102 | Info.Pre_Compiled_Sources.push_back(tmp.c_str()); 103 | i++; 104 | } 105 | } 106 | 107 | void Usr::Find_Repo_Dir(int& i) 108 | { 109 | if ((i <= Argument_Amount) && strcmp(Input[i], "-repo-dir") == 0) 110 | { 111 | string tmp = string(Input[i + 1]); 112 | Info.Repo_Dir = tmp; 113 | i++; 114 | } 115 | } 116 | 117 | void Usr::Find_Debug_Type(int& i) 118 | { 119 | if ((i <= Argument_Amount) && strcmp(Input[i], "-d") == 0) 120 | { 121 | Info.Debug = true; 122 | } 123 | } 124 | 125 | void Usr::Find_VT_API(int& i) 126 | { 127 | string a = string(Input[i]); 128 | if ((i <= Argument_Amount) && strcmp(Input[i], "-vt") == 0) 129 | { 130 | string tmp = string(Input[i + 1]); 131 | Info.VT_API = tmp; 132 | i++; 133 | } 134 | } 135 | 136 | void Usr::Find_Reference_Count(int& i) 137 | { 138 | if ((i <= Argument_Amount) && strcmp(Input[i], "-reference-count-size") == 0) 139 | { 140 | string tmp = string(Input[i + 1]); 141 | Info.Reference_Count_Size = atoi(tmp.c_str()); 142 | i++; 143 | } 144 | } 145 | 146 | void Usr::Find_Evie_Executable_Position() 147 | { 148 | string Argv_0 = Input[0]; 149 | 150 | DOCKER::Update_Working_Dir(DOCKER::ReplaceAll(Argv_0, "\\", "/"), Info.Evie_Location); 151 | } 152 | 153 | void Usr::Find_Service(int& i) 154 | { 155 | string a = string(Input[i]); 156 | if ((i <= Argument_Amount) && strcmp(Input[i], "-service") == 0) 157 | { 158 | Info.Is_Service = true; 159 | } 160 | } 161 | 162 | void Usr::Find_Start_Function_Name(int& i){ 163 | if ((i <= Argument_Amount) && strcmp(Input[i], "-start") == 0) 164 | { 165 | string tmp = string(Input[i + 1]); 166 | Info.Start_Function_Name = tmp; 167 | i++; 168 | } 169 | } 170 | 171 | void Usr::Find_Allow_Inconsistencies(int& i){ 172 | if ((i <= Argument_Amount) && strcmp(Input[i], "-allow-inconsistencies") == 0){ 173 | Info.Allow_Inconsistencies = true; 174 | } 175 | } 176 | 177 | void Usr::Find_Use_Scraper(int& i){ 178 | // -use-scraper [true/false] 179 | if ((i <= Argument_Amount) && strcmp(Input[i], "-use-scraper") == 0){ 180 | string tmp = string(Input[i + 1]); 181 | Info.Use_Scraper = tmp == "true"; 182 | i++; 183 | } 184 | } 185 | 186 | void System::Fill_Empty_Arguments() 187 | { 188 | //Evie.exe -in IO/test.e 189 | 190 | //first check if bit mode is set or not 191 | if (Bytes_Mode == "0") 192 | Bytes_Mode = to_string(sizeof(void*)); 193 | 194 | //initialize the default reference count 195 | if (Reference_Count_Size == -1) 196 | Reference_Count_Size = atoi(Bytes_Mode.c_str()); 197 | 198 | //we can always use the source files name to output files name and add the .asm at the end 199 | if (Destination_File == "") 200 | Destination_File = (string)Source_File + "." + Format; 201 | 202 | if (Repo_Dir == "") { 203 | char* Env = getenv("Repo-Dir"); 204 | if (Env != nullptr) 205 | Repo_Dir = Env; 206 | else 207 | Repo_Dir = "Remote"; 208 | } 209 | 210 | 211 | 212 | replace(Repo_Dir.begin(), Repo_Dir.end(), '\\', '/'); 213 | } 214 | 215 | bool is_number(const string& s) 216 | { 217 | return !s.empty() && std::find_if(s.begin(), 218 | s.end(), [](unsigned char c) { return !std::isdigit(c); }) == s.end(); 219 | } 220 | 221 | optional If_Int(string s) { 222 | if (is_number(s)) 223 | { 224 | return optional { 225 | atoi(s.c_str()) 226 | }; 227 | } 228 | return nullopt; 229 | } 230 | 231 | void Usr::Single_Argument_Use(){ 232 | Info.Source_File = string( Input[1]); 233 | } -------------------------------------------------------------------------------- /Credits/NM_LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 MinGW.org project 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a 4 | copy of this software and associated documentation files (the "Software"), 5 | to deal in the Software without restriction, including without limitation 6 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | and/or sell copies of the Software, and to permit persons to whom the 8 | Software is furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice, this permission notice and the below disclaimer 11 | shall be included in all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /Credits/OBJECT_LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2020 Joonas Lehto 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /Dependencies/Curl/.gitignore: -------------------------------------------------------------------------------- 1 | curlver.h.dist 2 | stamp-h2 3 | stamp-h3 4 | -------------------------------------------------------------------------------- /Dependencies/Curl/Makefile.am: -------------------------------------------------------------------------------- 1 | #*************************************************************************** 2 | # _ _ ____ _ 3 | # Project ___| | | | _ \| | 4 | # / __| | | | |_) | | 5 | # | (__| |_| | _ <| |___ 6 | # \___|\___/|_| \_\_____| 7 | # 8 | # Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. 9 | # 10 | # This software is licensed as described in the file COPYING, which 11 | # you should have received as part of this distribution. The terms 12 | # are also available at https://curl.se/docs/copyright.html. 13 | # 14 | # You may opt to use, copy, modify, merge, publish, distribute and/or sell 15 | # copies of the Software, and permit persons to whom the Software is 16 | # furnished to do so, under the terms of the COPYING file. 17 | # 18 | # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 19 | # KIND, either express or implied. 20 | # 21 | ########################################################################### 22 | pkginclude_HEADERS = \ 23 | curl.h curlver.h easy.h mprintf.h stdcheaders.h multi.h \ 24 | typecheck-gcc.h system.h urlapi.h options.h 25 | 26 | pkgincludedir= $(includedir)/curl 27 | 28 | CHECKSRC = $(CS_$(V)) 29 | CS_0 = @echo " RUN " $@; 30 | CS_1 = 31 | CS_ = $(CS_0) 32 | 33 | checksrc: 34 | $(CHECKSRC)@PERL@ $(top_srcdir)/lib/checksrc.pl -D$(top_srcdir)/include/curl $(pkginclude_HEADERS) 35 | 36 | if CURLDEBUG 37 | # for debug builds, we scan the sources on all regular make invokes 38 | all-local: checksrc 39 | endif 40 | -------------------------------------------------------------------------------- /Dependencies/Curl/curlver.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_CURLVER_H 2 | #define CURLINC_CURLVER_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | 25 | /* This header file contains nothing but libcurl version info, generated by 26 | a script at release-time. This was made its own header file in 7.11.2 */ 27 | 28 | /* This is the global package copyright */ 29 | #define LIBCURL_COPYRIGHT "1996 - 2021 Daniel Stenberg, ." 30 | 31 | /* This is the version number of the libcurl package from which this header 32 | file origins: */ 33 | #define LIBCURL_VERSION "7.76.0-DEV" 34 | 35 | /* The numeric version number is also available "in parts" by using these 36 | defines: */ 37 | #define LIBCURL_VERSION_MAJOR 7 38 | #define LIBCURL_VERSION_MINOR 76 39 | #define LIBCURL_VERSION_PATCH 0 40 | 41 | /* This is the numeric version of the libcurl version number, meant for easier 42 | parsing and comparisons by programs. The LIBCURL_VERSION_NUM define will 43 | always follow this syntax: 44 | 45 | 0xXXYYZZ 46 | 47 | Where XX, YY and ZZ are the main version, release and patch numbers in 48 | hexadecimal (using 8 bits each). All three numbers are always represented 49 | using two digits. 1.2 would appear as "0x010200" while version 9.11.7 50 | appears as "0x090b07". 51 | 52 | This 6-digit (24 bits) hexadecimal number does not show pre-release number, 53 | and it is always a greater number in a more recent release. It makes 54 | comparisons with greater than and less than work. 55 | 56 | Note: This define is the full hex number and _does not_ use the 57 | CURL_VERSION_BITS() macro since curl's own configure script greps for it 58 | and needs it to contain the full number. 59 | */ 60 | #define LIBCURL_VERSION_NUM 0x074c00 61 | 62 | /* 63 | * This is the date and time when the full source package was created. The 64 | * timestamp is not stored in git, as the timestamp is properly set in the 65 | * tarballs by the maketgz script. 66 | * 67 | * The format of the date follows this template: 68 | * 69 | * "2007-11-23" 70 | */ 71 | #define LIBCURL_TIMESTAMP "[unreleased]" 72 | 73 | #define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|(z)) 74 | #define CURL_AT_LEAST_VERSION(x,y,z) \ 75 | (LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z)) 76 | 77 | #endif /* CURLINC_CURLVER_H */ 78 | -------------------------------------------------------------------------------- /Dependencies/Curl/easy.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_EASY_H 2 | #define CURLINC_EASY_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* Flag bits in the curl_blob struct: */ 29 | #define CURL_BLOB_COPY 1 /* tell libcurl to copy the data */ 30 | #define CURL_BLOB_NOCOPY 0 /* tell libcurl to NOT copy the data */ 31 | 32 | struct curl_blob { 33 | void *data; 34 | size_t len; 35 | unsigned int flags; /* bit 0 is defined, the rest are reserved and should be 36 | left zeroes */ 37 | }; 38 | 39 | CURL_EXTERN CURL *curl_easy_init(void); 40 | CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...); 41 | CURL_EXTERN CURLcode curl_easy_perform(CURL *curl); 42 | CURL_EXTERN void curl_easy_cleanup(CURL *curl); 43 | 44 | /* 45 | * NAME curl_easy_getinfo() 46 | * 47 | * DESCRIPTION 48 | * 49 | * Request internal information from the curl session with this function. The 50 | * third argument MUST be a pointer to a long, a pointer to a char * or a 51 | * pointer to a double (as the documentation describes elsewhere). The data 52 | * pointed to will be filled in accordingly and can be relied upon only if the 53 | * function returns CURLE_OK. This function is intended to get used *AFTER* a 54 | * performed transfer, all results from this function are undefined until the 55 | * transfer is completed. 56 | */ 57 | CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...); 58 | 59 | 60 | /* 61 | * NAME curl_easy_duphandle() 62 | * 63 | * DESCRIPTION 64 | * 65 | * Creates a new curl session handle with the same options set for the handle 66 | * passed in. Duplicating a handle could only be a matter of cloning data and 67 | * options, internal state info and things like persistent connections cannot 68 | * be transferred. It is useful in multithreaded applications when you can run 69 | * curl_easy_duphandle() for each new thread to avoid a series of identical 70 | * curl_easy_setopt() invokes in every thread. 71 | */ 72 | CURL_EXTERN CURL *curl_easy_duphandle(CURL *curl); 73 | 74 | /* 75 | * NAME curl_easy_reset() 76 | * 77 | * DESCRIPTION 78 | * 79 | * Re-initializes a CURL handle to the default values. This puts back the 80 | * handle to the same state as it was in when it was just created. 81 | * 82 | * It does keep: live connections, the Session ID cache, the DNS cache and the 83 | * cookies. 84 | */ 85 | CURL_EXTERN void curl_easy_reset(CURL *curl); 86 | 87 | /* 88 | * NAME curl_easy_recv() 89 | * 90 | * DESCRIPTION 91 | * 92 | * Receives data from the connected socket. Use after successful 93 | * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. 94 | */ 95 | CURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, 96 | size_t *n); 97 | 98 | /* 99 | * NAME curl_easy_send() 100 | * 101 | * DESCRIPTION 102 | * 103 | * Sends data over the connected socket. Use after successful 104 | * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. 105 | */ 106 | CURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer, 107 | size_t buflen, size_t *n); 108 | 109 | 110 | /* 111 | * NAME curl_easy_upkeep() 112 | * 113 | * DESCRIPTION 114 | * 115 | * Performs connection upkeep for the given session handle. 116 | */ 117 | CURL_EXTERN CURLcode curl_easy_upkeep(CURL *curl); 118 | 119 | #ifdef __cplusplus 120 | } 121 | #endif 122 | 123 | #endif 124 | -------------------------------------------------------------------------------- /Dependencies/Curl/libcurl.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gabidal/Evie_Old/f9d187c246f566201b41dfada582df3b18a108c3/Dependencies/Curl/libcurl.lib -------------------------------------------------------------------------------- /Dependencies/Curl/libcurl.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gabidal/Evie_Old/f9d187c246f566201b41dfada582df3b18a108c3/Dependencies/Curl/libcurl.so -------------------------------------------------------------------------------- /Dependencies/Curl/mprintf.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_MPRINTF_H 2 | #define CURLINC_MPRINTF_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | 25 | #include 26 | #include /* needed for FILE */ 27 | #include "curl.h" /* for CURL_EXTERN */ 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | CURL_EXTERN int curl_mprintf(const char *format, ...); 34 | CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...); 35 | CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...); 36 | CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength, 37 | const char *format, ...); 38 | CURL_EXTERN int curl_mvprintf(const char *format, va_list args); 39 | CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args); 40 | CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args); 41 | CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength, 42 | const char *format, va_list args); 43 | CURL_EXTERN char *curl_maprintf(const char *format, ...); 44 | CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args); 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | #endif /* CURLINC_MPRINTF_H */ 51 | -------------------------------------------------------------------------------- /Dependencies/Curl/options.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_OPTIONS_H 2 | #define CURLINC_OPTIONS_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 2018 - 2020, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | typedef enum { 30 | CURLOT_LONG, /* long (a range of values) */ 31 | CURLOT_VALUES, /* (a defined set or bitmask) */ 32 | CURLOT_OFF_T, /* curl_off_t (a range of values) */ 33 | CURLOT_OBJECT, /* pointer (void *) */ 34 | CURLOT_STRING, /* (char * to zero terminated buffer) */ 35 | CURLOT_SLIST, /* (struct curl_slist *) */ 36 | CURLOT_CBPTR, /* (void * passed as-is to a callback) */ 37 | CURLOT_BLOB, /* blob (struct curl_blob *) */ 38 | CURLOT_FUNCTION /* function pointer */ 39 | } curl_easytype; 40 | 41 | /* Flag bits */ 42 | 43 | /* "alias" means it is provided for old programs to remain functional, 44 | we prefer another name */ 45 | #define CURLOT_FLAG_ALIAS (1<<0) 46 | 47 | /* The CURLOPTTYPE_* id ranges can still be used to figure out what type/size 48 | to use for curl_easy_setopt() for the given id */ 49 | struct curl_easyoption { 50 | const char *name; 51 | CURLoption id; 52 | curl_easytype type; 53 | unsigned int flags; 54 | }; 55 | 56 | CURL_EXTERN const struct curl_easyoption * 57 | curl_easy_option_by_name(const char *name); 58 | 59 | CURL_EXTERN const struct curl_easyoption * 60 | curl_easy_option_by_id (CURLoption id); 61 | 62 | CURL_EXTERN const struct curl_easyoption * 63 | curl_easy_option_next(const struct curl_easyoption *prev); 64 | 65 | #ifdef __cplusplus 66 | } /* end of extern "C" */ 67 | #endif 68 | #endif /* CURLINC_OPTIONS_H */ 69 | -------------------------------------------------------------------------------- /Dependencies/Curl/stdcheaders.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_STDCHEADERS_H 2 | #define CURLINC_STDCHEADERS_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | 25 | #include 26 | 27 | size_t fread(void *, size_t, size_t, FILE *); 28 | size_t fwrite(const void *, size_t, size_t, FILE *); 29 | 30 | int strcasecmp(const char *, const char *); 31 | int strncasecmp(const char *, const char *, size_t); 32 | 33 | #endif /* CURLINC_STDCHEADERS_H */ 34 | -------------------------------------------------------------------------------- /Dependencies/Curl/urlapi.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_URLAPI_H 2 | #define CURLINC_URLAPI_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 2018 - 2020, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | 25 | #include "curl.h" 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* the error codes for the URL API */ 32 | typedef enum { 33 | CURLUE_OK, 34 | CURLUE_BAD_HANDLE, /* 1 */ 35 | CURLUE_BAD_PARTPOINTER, /* 2 */ 36 | CURLUE_MALFORMED_INPUT, /* 3 */ 37 | CURLUE_BAD_PORT_NUMBER, /* 4 */ 38 | CURLUE_UNSUPPORTED_SCHEME, /* 5 */ 39 | CURLUE_URLDECODE, /* 6 */ 40 | CURLUE_OUT_OF_MEMORY, /* 7 */ 41 | CURLUE_USER_NOT_ALLOWED, /* 8 */ 42 | CURLUE_UNKNOWN_PART, /* 9 */ 43 | CURLUE_NO_SCHEME, /* 10 */ 44 | CURLUE_NO_USER, /* 11 */ 45 | CURLUE_NO_PASSWORD, /* 12 */ 46 | CURLUE_NO_OPTIONS, /* 13 */ 47 | CURLUE_NO_HOST, /* 14 */ 48 | CURLUE_NO_PORT, /* 15 */ 49 | CURLUE_NO_QUERY, /* 16 */ 50 | CURLUE_NO_FRAGMENT /* 17 */ 51 | } CURLUcode; 52 | 53 | typedef enum { 54 | CURLUPART_URL, 55 | CURLUPART_SCHEME, 56 | CURLUPART_USER, 57 | CURLUPART_PASSWORD, 58 | CURLUPART_OPTIONS, 59 | CURLUPART_HOST, 60 | CURLUPART_PORT, 61 | CURLUPART_PATH, 62 | CURLUPART_QUERY, 63 | CURLUPART_FRAGMENT, 64 | CURLUPART_ZONEID /* added in 7.65.0 */ 65 | } CURLUPart; 66 | 67 | #define CURLU_DEFAULT_PORT (1<<0) /* return default port number */ 68 | #define CURLU_NO_DEFAULT_PORT (1<<1) /* act as if no port number was set, 69 | if the port number matches the 70 | default for the scheme */ 71 | #define CURLU_DEFAULT_SCHEME (1<<2) /* return default scheme if 72 | missing */ 73 | #define CURLU_NON_SUPPORT_SCHEME (1<<3) /* allow non-supported scheme */ 74 | #define CURLU_PATH_AS_IS (1<<4) /* leave dot sequences */ 75 | #define CURLU_DISALLOW_USER (1<<5) /* no user+password allowed */ 76 | #define CURLU_URLDECODE (1<<6) /* URL decode on get */ 77 | #define CURLU_URLENCODE (1<<7) /* URL encode on set */ 78 | #define CURLU_APPENDQUERY (1<<8) /* append a form style part */ 79 | #define CURLU_GUESS_SCHEME (1<<9) /* legacy curl-style guessing */ 80 | #define CURLU_NO_AUTHORITY (1<<10) /* Allow empty authority when the 81 | scheme is unknown. */ 82 | 83 | typedef struct Curl_URL CURLU; 84 | 85 | /* 86 | * curl_url() creates a new CURLU handle and returns a pointer to it. 87 | * Must be freed with curl_url_cleanup(). 88 | */ 89 | CURL_EXTERN CURLU *curl_url(void); 90 | 91 | /* 92 | * curl_url_cleanup() frees the CURLU handle and related resources used for 93 | * the URL parsing. It will not free strings previously returned with the URL 94 | * API. 95 | */ 96 | CURL_EXTERN void curl_url_cleanup(CURLU *handle); 97 | 98 | /* 99 | * curl_url_dup() duplicates a CURLU handle and returns a new copy. The new 100 | * handle must also be freed with curl_url_cleanup(). 101 | */ 102 | CURL_EXTERN CURLU *curl_url_dup(CURLU *in); 103 | 104 | /* 105 | * curl_url_get() extracts a specific part of the URL from a CURLU 106 | * handle. Returns error code. The returned pointer MUST be freed with 107 | * curl_free() afterwards. 108 | */ 109 | CURL_EXTERN CURLUcode curl_url_get(CURLU *handle, CURLUPart what, 110 | char **part, unsigned int flags); 111 | 112 | /* 113 | * curl_url_set() sets a specific part of the URL in a CURLU handle. Returns 114 | * error code. The passed in string will be copied. Passing a NULL instead of 115 | * a part string, clears that part. 116 | */ 117 | CURL_EXTERN CURLUcode curl_url_set(CURLU *handle, CURLUPart what, 118 | const char *part, unsigned int flags); 119 | 120 | 121 | #ifdef __cplusplus 122 | } /* end of extern "C" */ 123 | #endif 124 | 125 | #endif /* CURLINC_URLAPI_H */ 126 | -------------------------------------------------------------------------------- /Dependencies/Mingw/make.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gabidal/Evie_Old/f9d187c246f566201b41dfada582df3b18a108c3/Dependencies/Mingw/make.exe -------------------------------------------------------------------------------- /Evie.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.1.32127.271 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Evie", "Evie.vcxproj", "{B9ED3706-EFBC-4AF6-AFD5-8254AE2665F6}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | Test|x64 = Test|x64 15 | Test|x86 = Test|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {B9ED3706-EFBC-4AF6-AFD5-8254AE2665F6}.Debug|x64.ActiveCfg = Debug|x64 19 | {B9ED3706-EFBC-4AF6-AFD5-8254AE2665F6}.Debug|x64.Build.0 = Debug|x64 20 | {B9ED3706-EFBC-4AF6-AFD5-8254AE2665F6}.Debug|x86.ActiveCfg = Debug|Win32 21 | {B9ED3706-EFBC-4AF6-AFD5-8254AE2665F6}.Debug|x86.Build.0 = Debug|Win32 22 | {B9ED3706-EFBC-4AF6-AFD5-8254AE2665F6}.Release|x64.ActiveCfg = Release|x64 23 | {B9ED3706-EFBC-4AF6-AFD5-8254AE2665F6}.Release|x64.Build.0 = Release|x64 24 | {B9ED3706-EFBC-4AF6-AFD5-8254AE2665F6}.Release|x86.ActiveCfg = Release|Win32 25 | {B9ED3706-EFBC-4AF6-AFD5-8254AE2665F6}.Release|x86.Build.0 = Release|Win32 26 | {B9ED3706-EFBC-4AF6-AFD5-8254AE2665F6}.Test|x64.ActiveCfg = Test|x64 27 | {B9ED3706-EFBC-4AF6-AFD5-8254AE2665F6}.Test|x64.Build.0 = Test|x64 28 | {B9ED3706-EFBC-4AF6-AFD5-8254AE2665F6}.Test|x86.ActiveCfg = Test|Win32 29 | {B9ED3706-EFBC-4AF6-AFD5-8254AE2665F6}.Test|x86.Build.0 = Test|Win32 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | GlobalSection(ExtensibilityGlobals) = postSolution 35 | SolutionGuid = {735F3F72-F4F2-4DF1-A45A-40C9633ECDAD} 36 | EndGlobalSection 37 | EndGlobal 38 | -------------------------------------------------------------------------------- /Evie.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -in IO/test.e 5 | WindowsLocalDebugger 6 | 7 | 8 | -in IO/test.e 9 | WindowsLocalDebugger 10 | 11 | 12 | -service 13 | WindowsLocalDebugger 14 | 15 | 16 | true 17 | 18 | -------------------------------------------------------------------------------- /H/Assembler/Assembler.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASSEMBLER_H_ 2 | #define _ASSEMBLER_H_ 3 | 4 | //#include "Assembler_Types.h" 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | using namespace std; 13 | 14 | //Transforms the input string into a vector of tokens 15 | //Where 'mov rax, qword ptr [rax]', transforms into: 16 | //name = mov: 17 | // Childs[0] = name = rax 18 | // Childs[1] = name = []: 19 | // Childs[0] = name = rax 20 | // size = qword ptr 21 | // size = qword ptr 22 | 23 | class Symbol_Data{ 24 | public: 25 | long long Address; 26 | int Section_ID; 27 | class Node* Origin; 28 | }; 29 | 30 | class Assembler{ 31 | public: 32 | vector Output; 33 | 34 | // name, Origin, address, section id 35 | map Symbol_Table; 36 | 37 | Assembler(){} 38 | 39 | void Factory(string Input); 40 | void Factory(vector IRs); 41 | 42 | //Tokenizer stuff 43 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ 44 | vector Tokenizer(string Input); 45 | int Get_Paranthesis_Content_Length(char Opening_Paranthesis_Type, int Start_Index, string Input); 46 | char Get_Closing_Character(char Opening_Character); 47 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ 48 | 49 | //Grouper stuff 50 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ 51 | vector Grouper(vector Tokens); 52 | 53 | //Parser stuff 54 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ 55 | vector Parser(vector Tokens); 56 | 57 | //Post-Prosessor stuff 58 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ 59 | vector Parser_Post_Prosessor(vector IRs); 60 | 61 | //Encoder stuff 62 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ 63 | vector Intermediate_Encoder(vector); 64 | 65 | void Calculate_Constant_Expressions(Token* Current, unordered_set& Trace); 66 | void Calculate_Constant_Expressions(Token* Current); 67 | 68 | 69 | //Symbol Table stuff 70 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ 71 | void Generate_Symbol_Table_For(string Label, long long Address, int Section_ID, class Node* Origin); 72 | }; 73 | 74 | 75 | #endif -------------------------------------------------------------------------------- /H/BackEnd/ARM.h: -------------------------------------------------------------------------------- 1 | #ifndef _ARM_H_ 2 | #define _ARM_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | using namespace std; 9 | 10 | #include "../Nodes/Token.h" 11 | #include "../Nodes/IR.h" 12 | #include "../Flags.h" 13 | 14 | class ARM_64 { 15 | public: 16 | int size; 17 | vector Registers; 18 | vector Parameter_Registers; 19 | vector Opcodes; 20 | vector Utility; 21 | vector Size_Identifiers; 22 | 23 | string Seperator; 24 | string Register_Pre_Fix; 25 | string Number_Pre_Fix; 26 | string Label_Post_Fix; 27 | void Init(); 28 | // needs add or sub for the operation. 29 | static pair, bool> Un_Wrap_Content(Token* t); 30 | 31 | //DEBUG 32 | int STACK_REPRESENTIVE_REGISTER = 111; //SP 33 | }; 34 | 35 | #endif -------------------------------------------------------------------------------- /H/BackEnd/BackEnd.h: -------------------------------------------------------------------------------- 1 | #ifndef _BACKEND_H_ 2 | #define _BACKEND_H_ 3 | #include "x86.h" 4 | #include "ARM.h" 5 | #include "../UI/Usr.h" 6 | #include "../Nodes/IR.h" 7 | #include "../Nodes/Token.h" 8 | #include "../../H/BackEnd/Selector.h" 9 | 10 | 11 | #include 12 | #include 13 | 14 | using namespace std; 15 | 16 | class BackEnd { 17 | private: 18 | string Seperator = ""; 19 | string Register_Pre_Fix = ""; 20 | string Number_Pre_Fix = ""; 21 | string Label_Post_Fix = ""; 22 | 23 | vector Input; 24 | string* Output; 25 | 26 | void Init(); 27 | void Factory(); 28 | void Operator_Builder(IR* i); 29 | void Label_Builder(IR* i); 30 | void End_Of_Function_Builder(IR* i); 31 | void Call_Builder(IR* i); 32 | void Global_Builder(IR* i); 33 | 34 | string Token_Builder(Token* t, bool Inside_Content = false); 35 | public: 36 | BackEnd(vector in) : Input(in) { 37 | Output = new string(""); 38 | Init(); 39 | Factory(); 40 | } 41 | BackEnd(vector in, string& out) : Input(in), Output(&out) { 42 | Init(); 43 | Factory(); 44 | } 45 | }; 46 | 47 | #endif -------------------------------------------------------------------------------- /H/BackEnd/DebugGenerator.h: -------------------------------------------------------------------------------- 1 | #ifndef _DEBUGGENERATOR_H_ 2 | #define _DEBUGGENERATOR_H_ 3 | 4 | #include "../BackEnd/Selector.h" //Degub Generator needs the Size identifiers from selector 5 | #include "../Nodes/IR.h" //Degub Generator needs to generate the sybols as a IR tokens 6 | #include "../Nodes/Token.h" //Degub Generator needs to generate the sybols as a IR tokens 7 | #include "../Nodes/Node.h" //Debug info for functions and variable generation. 8 | #include "../Docker/Docker.h" //Debug info for all used source files. 9 | #include "../Docker/Mangler.h" 10 | 11 | #include 12 | #include 13 | 14 | using namespace std; 15 | 16 | extern Node* Global_Scope; 17 | extern Selector* selector; 18 | 19 | class Abbrev_Type { 20 | public: 21 | bool ID = false; 22 | int TAG = -1; 23 | bool HAS_CHILDREN = false; 24 | bool CALLING_CONVENTION = false; 25 | bool MEMORY_LOCATION = false; 26 | bool START = false; 27 | bool END = false; 28 | bool STACK_FRAME_LOCATION = false; 29 | bool STACK_FRAME_REPRESENTIVE_REGISTER = false; 30 | bool MANGLED_NAME = false; 31 | bool NAME = false; 32 | bool ENCODING = false; 33 | bool BYTE_SIZE = false; 34 | bool SOURCE_FILE = false; 35 | bool SOURCE_LINE = false; 36 | bool TYPE = false; 37 | bool EXTERNAL = false; 38 | 39 | bool operator==(Abbrev_Type b) { 40 | return ID == b.ID && 41 | TAG == b.TAG && 42 | HAS_CHILDREN == b.HAS_CHILDREN && 43 | MEMORY_LOCATION == b.MEMORY_LOCATION && 44 | START == b.START && 45 | END == b.END && 46 | STACK_FRAME_LOCATION == b.STACK_FRAME_LOCATION && 47 | STACK_FRAME_REPRESENTIVE_REGISTER == b.STACK_FRAME_REPRESENTIVE_REGISTER && 48 | MANGLED_NAME == b.MANGLED_NAME && 49 | NAME == b.NAME && 50 | ENCODING == b.ENCODING && 51 | BYTE_SIZE == b.BYTE_SIZE && 52 | SOURCE_FILE == b.SOURCE_FILE && 53 | SOURCE_LINE == b.SOURCE_LINE && 54 | TYPE == b.TYPE && 55 | EXTERNAL == b.EXTERNAL 56 | ; 57 | } 58 | 59 | Abbrev_Type(Node* n); 60 | Abbrev_Type(){} 61 | }; 62 | 63 | class DebugGenerator 64 | { 65 | public: 66 | DebugGenerator(vector &input); 67 | ~DebugGenerator(){} 68 | 69 | void Construct_Debug_Abbrev(); 70 | void Construct_Debug_Info(); 71 | void Construct_Debug_String(); 72 | void Construct_Line_Table(); 73 | void Define_File_Index(); 74 | 75 | 76 | void Info_Generator(Node* n); 77 | void Generate_Abbrev(Abbrev_Type abbrev); 78 | 79 | 80 | void Insert_Start_End_Labels(vector& input); 81 | void Insert_Line_Change_Information(vector& input); 82 | void Insert_Stack_Info(vector &Input); 83 | private: 84 | vector Debug_Abbrev; //describes all needed debug information about the debuggable code. 85 | vector Debug_Info; //lists all needed degub information about the debuggable code. 86 | vector Debug_Str; //lists all string used in the debuggable code. 87 | vector Debug_Line; //unknown section! 88 | vector File_Index; //defines a index to every used source file 89 | vector Line_Table; 90 | vector> Files; //File_Name, Index representive 91 | vector> Abbrovation_IDs; 92 | vector Genrated_Info; 93 | 94 | int Get_Index_From_File(string s); 95 | int Get_Abbrovation_Index(Node* n); 96 | }; 97 | 98 | #endif -------------------------------------------------------------------------------- /H/BackEnd/IRGenerator.h: -------------------------------------------------------------------------------- 1 | #ifndef _IRGENERATOR_H_ 2 | #define _IRGENERATOR_H_ 3 | #include "../Nodes/IR.h" 4 | #include "../Nodes/Token.h" 5 | #include "../Nodes/Node.h" 6 | #include "../Flags.h" 7 | 8 | #include 9 | #include 10 | 11 | using namespace std; 12 | 13 | class IRGenerator { 14 | public: 15 | Node* Scope = nullptr; 16 | Token* Handle = nullptr; 17 | 18 | vector* Output; 19 | vector Input; 20 | 21 | IRGenerator(Node* p) : Scope(p) { Output = new vector; } 22 | IRGenerator(Node* p, vector in) : Scope(p), Input(in) { Output = new vector; } 23 | IRGenerator(Node* p, vector in, vector* Out) : Scope(p), Input(in), Output(Out) { Factory(); } 24 | IRGenerator(Node* p, vector in, vector* Out, bool assign) : Scope(p), Input(in), Output(Out), Is_In_Left_Side_Of_Operator(assign) { Factory(); } 25 | IRGenerator(Node* p, vector* Out) : Scope(p), Output(Out){} 26 | void Generate(vector in, bool set_insert_mode) { Handle = nullptr; Input = in; Is_In_Left_Side_Of_Operator = set_insert_mode; Factory(); } 27 | 28 | void Factory(); 29 | 30 | void Parse_Classes(Node* Class); 31 | void Parse_Function(Node* Func); 32 | void Parse_Calls(int i); 33 | void Parse_If(int i); 34 | void Loop_Elses(Node* e); 35 | void Parse_Loops(int i); 36 | void Parse_Return(int i); 37 | 38 | void Parse_Logical_Conditions(int i); 39 | void Parse_Cloning(int i); 40 | void Parse_Operators(int i); 41 | void Parse_Conditional_Jumps(int i); 42 | void Parse_Pointers(int i); 43 | void Parse_Arrays(int i); 44 | void Parse_PreFixes(int i); 45 | void Parse_PostFixes(int i); 46 | void Parse_Reference_Count_Increase(int i); 47 | 48 | void Parse_Jump(int i); 49 | void Parse_Labels(int i); 50 | void Parse_Parenthesis(int i); 51 | void Update_Operator(Node*n); 52 | 53 | void Generate_Global_Variable(Node* label, Node* value); 54 | void Parse_Global_Variables(Node* n); 55 | void Parse_Static_Variables(Node* n); 56 | string Construct_Complex_Init_Values(Node* n); 57 | 58 | void Parse_Member_Fetch(Node* n); 59 | 60 | //SAFE system 2000 61 | void De_couple_Memory_To_Memory_Arguments(int& i); 62 | 63 | //void Switch_To_Correct_Places(Node* o); 64 | 65 | void Parse_Static_Casting(Node* n); 66 | void Parse_Dynamic_Casting(Node* n); 67 | void Parse_Elevated_Variable(Node* n); 68 | //TODO: hey gab! use log(inlining count) base 10 for the global inlining label adding rendom char adder. 69 | //TODO: make a repeating optimizer thet makes 70 | //a new variable and saves the result once and then uses it those other times 71 | string Get_Inverted_Condition(string c, Position* p); 72 | vector Get_All_Extern_Variables(int end_index, int start_index, Node* scope); 73 | vector Find(string n, Token* t); 74 | vector Find(long n, Token* t); 75 | 76 | //p is the pointter , , -x unwrap | +x wrap 77 | Token* Operate_Pointter(Token* p, int Difference, bool Needed_At_Addressing, bool Unwrap_Memory, vector Types = vector()); 78 | 79 | IR* Make_Label(Node* n, bool Mangle = false); 80 | IR* Make_Label(string n); 81 | IR* Make_Jump(string condition, string l); 82 | static int Get_Amount(string t, Node* n); 83 | 84 | private: 85 | bool Is_In_Left_Side_Of_Operator = false; 86 | static vector Get_all(int f, vector l) { 87 | vector Result; 88 | for (Node* n : l) 89 | if (n->is(f)) 90 | Result.push_back(n); 91 | return Result; 92 | } 93 | }; 94 | 95 | #endif -------------------------------------------------------------------------------- /H/BackEnd/IROptimizer.h: -------------------------------------------------------------------------------- 1 | #ifndef _IROPTIMIZER_H_ 2 | #define _IROPTIMIZER_H_ 3 | 4 | #include "../Nodes/IR.h" 5 | 6 | #include 7 | 8 | using namespace std; 9 | 10 | class IROptimizer{ 11 | public: 12 | 13 | vector& Input; 14 | 15 | IROptimizer(vector& input) : Input(input) { 16 | Factory(); 17 | } 18 | 19 | void Factory(); 20 | 21 | vector Liquify_MEM_AST(Token* mem); 22 | 23 | void Switch_Operator_Sides(vector& liquid); 24 | 25 | void Switch_Sides(vector& liquid, int l, int r); 26 | 27 | void Combine_Scale_And_Offset_In_Memory(Token* mem); 28 | 29 | }; 30 | 31 | #endif -------------------------------------------------------------------------------- /H/BackEnd/IRPostProsessor.h: -------------------------------------------------------------------------------- 1 | #ifndef _IRPOSTPROSESSOR_H_ 2 | #define _IRPOSTPROSESSOR_H_ 3 | 4 | #include "../Flags.h" 5 | #include "../Nodes/IR.h" 6 | #include "../Nodes/Token.h" 7 | #include "../../H/BackEnd/Selector.h" 8 | 9 | 10 | #include 11 | #include 12 | 13 | using namespace std; 14 | 15 | class IRPostProsessor { 16 | private: 17 | vector* Input; 18 | 19 | void Scale_To_Same_Size(int i); 20 | void Registerize(Token* t, int i); 21 | void Give_New_Register(Token* t, int i); 22 | void Handle_Global_Labels(); 23 | void Clean_Selector(int& i); 24 | void Prepare_Function(int& i); 25 | void Handle_Labels(int i); 26 | 27 | void Handle_Stack_Usages(Token* t); 28 | int Parse_Complex(IR* ir, int i, bool Registry); 29 | public: 30 | IRPostProsessor(vector* in) : Input(in) { Factory(); } 31 | void Factory(); 32 | }; 33 | 34 | #endif -------------------------------------------------------------------------------- /H/BackEnd/Selector.h: -------------------------------------------------------------------------------- 1 | #ifndef _SELECTOR_H_ 2 | #define _SELECTOR_H_ 3 | #include 4 | #include 5 | #include 6 | 7 | #include "../Nodes/IR.h" 8 | #include "../Nodes/Token.h" 9 | #include "x86.h" 10 | #include "ARM.h" 11 | 12 | using namespace std; 13 | 14 | class Descriptor { 15 | public: 16 | int First_Usage_Index = 0; 17 | int Last_Usage_Index = 0; 18 | 19 | string User = ""; 20 | Node* Scope = nullptr; 21 | 22 | Descriptor(int first, int last, string usr, Node* Scope) : First_Usage_Index(first), Last_Usage_Index(last), User(usr), Scope(Scope){} 23 | }; 24 | 25 | class Path { 26 | //Path is a package class containing critical information about the path of specified value. 27 | public: 28 | vector Intersects_Calls; 29 | int Parameter_Place = -1; 30 | int Last_Usage = 0; 31 | }; 32 | 33 | //enum class ALLOCATED_FOR { 34 | // UN_DECIDED, 35 | // PARAMETER_SPACE, 36 | // PUSH_SPACE, 37 | // LOCAL_VARIABLE_SCAPE, 38 | // REGISTER_SAVE_SPACE, 39 | // CALL_PARAMETER_SPACE, 40 | //}; 41 | 42 | class Selector { 43 | public: 44 | void Init(); 45 | //tools 46 | bool Find(string n, Token* ast); 47 | bool Find(Token* n, Token* ast); 48 | //registers 49 | vector> Registers; 50 | vector> Stack; 51 | vector> Parameter_Registers; 52 | vector Transform(Token* parent); 53 | int Current_Parameter_Register_Index = 0; 54 | bool Previus_Parameter_Type_Decimal = false; 55 | 56 | //stack 57 | Node* Parent = nullptr; 58 | long long Stack_Pointter = 0; 59 | 60 | //Opcodes 61 | vector Opcodes; 62 | vector Size_Identifiers; 63 | 64 | Selector() { Init(); } 65 | Path* Get_Path_Info(vector source, int i, Token* t); 66 | //REGISTERS: 67 | // , , IRs, index 68 | void Make_Solution_For_Crossed_Register_Usages(pair< Descriptor*, Token*> Current, pair< Descriptor*, Token*> New, vector* source, int i); 69 | Token* Move_Parameter_Into_Non_Volatile(pair Owner, Token* Current_Reg, vector* source, int i); 70 | Token* Get_New_Reg(vector *source, int i, Token* t, Path* path = nullptr); 71 | Token* Get_Right_Parameter_Register(Token* t, int parameter_index); 72 | void Reset_Parameter_Register_Count(IR* r); 73 | Token* Get_Register(Token* t); 74 | Token* Get_Register(long F, Descriptor* user, int i, Token* t); 75 | int Get_Largest_Register_Size(); 76 | Descriptor* Check_If_Smaller_Register_Is_In_Use(Token* r); 77 | Descriptor* Check_If_Larger_Register_Is_In_Use(Token* r); 78 | void Allocate_Register(vector* source, int i, Token* t); 79 | void Pair_Up(Token* r, Descriptor* t); 80 | void Break_Up(Token* r); 81 | int Get_Numerical_Parameter_Register_Count(vector Parameters); 82 | int Get_Floating_Parameter_Register_Count(vector Parameters); 83 | void Clean_Register_Holders(); 84 | vector> Get_Register_Type(long f); 85 | Token* Get_Larger_Register(Token* Reg, Token* token); 86 | Token* Get_Smaller_Register(Token* Reg, Token* token); 87 | Token* Get_Largest_Register(Token* Reg); 88 | 89 | //STACK/HEAP: 90 | //void Save(Token* id, Token* v, vector* list, int i); 91 | //Token* Load(string id, vector* list, int i); 92 | void DeAllocate_Stack(int Amount, vector* list, int i); 93 | void Allocate_Stack(int Amount, vector* list, int i); 94 | void Init_Stack(Node* Func); 95 | Token* Get_Memory_Location(Token* v); 96 | void Clean_Stack(); 97 | long long Calculate_Memory_Address(Token* m); 98 | long long Calculate_Memory_Address(long long F); 99 | 100 | //OPCODES: 101 | IR* Get_Opcode(IR* i); 102 | bool Check_Resource_Availability(IR* i, vector>> Order); 103 | string Get_Size_Identifier(int s); 104 | 105 | //DEBUG 106 | int STACK_REPRESENTIVE_REGISTER; 107 | 108 | //UTILITY 109 | pair Compute_Function_Territory(vector Irs, long long i); 110 | vector Get_Stack_Deallocators_And_Allocators(pair Function_Territory, vector Irs); 111 | pair* Get_Register_User(Token* R); 112 | 113 | //Assembler 114 | class Byte_Map* (*Build)(IR*); 115 | vector (*Assemble)(class Byte_Map*); 116 | int (*Get_Size)(class Byte_Map*); 117 | 118 | int Get_Bits_Size(long long Value); 119 | 120 | //Linker 121 | unsigned short OBJ_Machine_ID; 122 | }; 123 | 124 | #endif -------------------------------------------------------------------------------- /H/BackEnd/x86.h: -------------------------------------------------------------------------------- 1 | #ifndef _X86_H_ 2 | #define _X86_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | using namespace std; 9 | 10 | #include "../Nodes/Token.h" 11 | #include "../Nodes/IR.h" 12 | #include "../Flags.h" 13 | #include "../Assembler/Assembler_Types.h" 14 | 15 | class x86_64 { 16 | public: 17 | int size; 18 | vector Registers; 19 | vector Parameter_Registers; 20 | vector Opcodes; 21 | vector Utility; 22 | vector Size_Identifiers; 23 | 24 | string Seperator; 25 | string Register_Pre_Fix; 26 | string Number_Pre_Fix; 27 | string Label_Post_Fix; 28 | 29 | unsigned short OBJ_Machine_ID; 30 | static inline map MODRMS; 31 | void Init(); 32 | 33 | //DEBUG 34 | int STACK_REPRESENTIVE_REGISTER; //RSP 35 | 36 | //Assembler 37 | static class Byte_Map* Build(IR* ir); 38 | static bool Needs_SIB(Token* RM); 39 | static int Get_Size_Without_Imm_And_Disp(class Byte_Map* input); 40 | static int Get_Size(class Byte_Map* input); 41 | static void Arrange_Encoding(vector& Args, OPCODE_ENCODING encoding); 42 | static void Modify_OpCode(class Byte_Map* b); 43 | static vector Assemble(class Byte_Map* Input); 44 | static SIB Get_SIB(Token* t, class Byte_Map& back_referece); 45 | static unsigned char Get_MODRM_Type(Token* t); 46 | static vector Reverse_Engineer_OpCode(vector Data, unsigned long long Start_Address); 47 | 48 | static bool is(unsigned char value, unsigned char mask) { 49 | return (value & mask) == mask; 50 | } 51 | }; 52 | 53 | static constexpr unsigned char REX_DEFAULT = 0b01000000; 54 | static constexpr unsigned char REX_W = 0b00001000; 55 | static constexpr unsigned char REX_R = 0b00000100; 56 | static constexpr unsigned char REX_X = 0b00000010; 57 | static constexpr unsigned char REX_B = 0b00000001; 58 | 59 | static constexpr unsigned char OPERAND_SIZE_OVERRIDE = 0b01100110; //0x66 60 | 61 | static constexpr unsigned char REX_BIT_SETTED = 0b1000; 62 | 63 | #endif -------------------------------------------------------------------------------- /H/Docker/ASM.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_H_ 2 | #define _ASM_H_ 3 | #include 4 | #include "Docker.h" 5 | #include 6 | 7 | using namespace std; 8 | 9 | namespace ASM { 10 | 11 | void ASM_Analyzer(vector& Output); 12 | } 13 | 14 | #endif -------------------------------------------------------------------------------- /H/Docker/DLL.h: -------------------------------------------------------------------------------- 1 | #ifndef _DLL_H_ 2 | #define _DLL_H_ 3 | 4 | #include 5 | #include 6 | #include "Docker.h" 7 | #include "OBJ.h" 8 | 9 | using namespace std; 10 | 11 | namespace DLL { 12 | vector Gather_All_Tables(vector buffer, PE::Header_64 h); 13 | 14 | vector Gather_All_Export_Names(PE::Header_64 h, vector buffer, PE::Section t); 15 | 16 | // [DLL: {Symbols}, ...] 17 | unordered_map> Gather_All_Import_Names(PE::Header_64 h, vector buffer, PE::Section t); 18 | 19 | void DLL_Analyser(vector& Output); 20 | 21 | void Enlarge_PE_Header(PE::PE_OBJ* obj); 22 | 23 | void Add_Base_Relocation_table(PE::PE_OBJ* obj, int Expected_Section_Count); 24 | 25 | void Write_Base_Relocation_Table(PE::PE_OBJ* obj, vector& buffer); 26 | 27 | vector Write_DLL(PE::PE_OBJ* obj); 28 | 29 | unsigned int Get_Bull_Shit_Header_Size(vector &buffer); 30 | 31 | PE::Section Get_Export_Table(vector &buffer); 32 | 33 | PE::Section Get_Import_Table(vector &buffer); 34 | 35 | PE::Header_64 Read_Headers(vector &buffer); 36 | 37 | bool Is_32_Bits(PE::Header_64 header); 38 | } 39 | 40 | #endif -------------------------------------------------------------------------------- /H/Docker/ELF.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gabidal/Evie_Old/f9d187c246f566201b41dfada582df3b18a108c3/H/Docker/ELF.h -------------------------------------------------------------------------------- /H/Docker/HTTPS.h: -------------------------------------------------------------------------------- 1 | #ifndef _HTTPS_H_ 2 | #define _HTTPS_H_ 3 | 4 | #include 5 | #include 6 | #include "Docker.h" 7 | 8 | 9 | using namespace std; 10 | 11 | struct MemoryStruct { 12 | char* memory; 13 | size_t size; 14 | MemoryStruct() { 15 | memory = (char*)malloc(1); 16 | size = 0; 17 | } 18 | }; 19 | 20 | size_t WriteMemoryCallback(void* contents, size_t size, size_t nmemb, void* userp); 21 | 22 | 23 | namespace HTTPS { 24 | extern string File_Name; 25 | void HTTPS_Analyser(vector& output); 26 | 27 | } 28 | 29 | namespace HTTP { 30 | 31 | } 32 | 33 | #endif -------------------------------------------------------------------------------- /H/Docker/LIB.h: -------------------------------------------------------------------------------- 1 | #ifndef _LIB_H_ 2 | #define _LIB_H_ 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "Docker.h" 11 | #include "../UI/Usr.h" 12 | #include "Section.h" 13 | using namespace std; 14 | 15 | namespace LIB { 16 | class Packet { 17 | public: 18 | struct { 19 | char File_Indentifier[16]; 20 | char File_Modification_Stamp[12]; 21 | char Owner_ID[6]; 22 | char Group_ID[6]; 23 | char File_Mode[8]; 24 | char File_Size[10]; 25 | char End_Char[2]; 26 | }Info; 27 | char* Buffer; 28 | }; 29 | 30 | void Generate_Binary_Symbols(string filename, string WD); 31 | void LIB_Analyzer(vector& Output); 32 | pair> Read_AR_File(string filename); 33 | pair> Read_LIB_File(string filename); 34 | } 35 | 36 | #endif -------------------------------------------------------------------------------- /H/Docker/Mangler.h: -------------------------------------------------------------------------------- 1 | #ifndef _MANGLER_H_ 2 | #define _MANGLER_H_ 3 | #include 4 | #include 5 | #include 6 | #include 7 | using namespace std; 8 | 9 | class Node; 10 | 11 | namespace MANGLER { 12 | enum Role { 13 | VARIABLE, 14 | PREFIX, 15 | POSTFIX, 16 | CLASS, 17 | END_CLASS, 18 | NUMBER, 19 | RETURN, 20 | }; 21 | string Un_Mangle(string raw); 22 | string Mangle(Node* raw, string Force_Complex); 23 | string Get_Function_Name(string func); 24 | bool Is_Base_Type(Node* n); 25 | bool Is_Based_On_Base_Type(Node* n); 26 | bool Is_Template(Node* n); 27 | int Find_Classes(string s); 28 | // alias , real id 29 | // P, ptr 30 | // i, int 31 | //cpp 32 | extern vector>>>> IDS; 33 | void Add_ID(string Lang, pair> id); 34 | string Get_Key(string Val, string Lang); 35 | vector>>* Find_STD_List(string Lang); 36 | pair* Find(string Key, vector>>* Current_IDS); 37 | void Clear_Class_Zipping_List(); 38 | 39 | } 40 | 41 | #endif -------------------------------------------------------------------------------- /H/Docker/Section.h: -------------------------------------------------------------------------------- 1 | #ifndef _SECTION_H_ 2 | #define _SECTION_H_ 3 | #include 4 | 5 | struct Section 6 | { 7 | uint8_t* start; 8 | uint64_t size; 9 | }; 10 | 11 | #endif -------------------------------------------------------------------------------- /H/Docker/TXT.h: -------------------------------------------------------------------------------- 1 | #ifndef _TXT_H_ 2 | #define _TXT_H_ 3 | #include 4 | #include 5 | #include "../Lexer/Lexer.h" 6 | #include "Docker.h" 7 | #include "../Lexer/Component.h" 8 | 9 | using namespace std; 10 | 11 | namespace TXT { 12 | void TXT_Analyzer(vector& Output); 13 | vector Unwrap(string raw); 14 | } 15 | 16 | #endif -------------------------------------------------------------------------------- /H/Flags.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLAGS_H_ 2 | #define _FLAGS_H_ 3 | 4 | #undef OPTIONAL 5 | 6 | enum class MODRM_ENCODING{ 7 | NON, 8 | MOD_RM, 9 | MOD_REG 10 | }; 11 | 12 | namespace TOKEN { 13 | static constexpr long long REGISTER = 1 << 0; //this is for that the selector can select an register if it sees this 14 | static constexpr long long VOLATILE = 1 << 1; 15 | static constexpr long long NONVOLATILE = 1 << 2; 16 | static constexpr long long RETURNING = 1 << 3; 17 | static constexpr long long PARAMETER = 1 << 4; //fast call 18 | static constexpr long long REMAINDER = 1 << 5; 19 | static constexpr long long QUOTIENT = 1 << 6; 20 | static constexpr long long STACK_POINTTER = 1 << 7; 21 | 22 | static constexpr long long NUM = 1 << 8; 23 | static constexpr long long DECIMAL = 1 << 9; 24 | 25 | static constexpr long long MEMORY = 1 << 10; 26 | 27 | static constexpr long long OPERATOR = 1 << 11; //any operator 28 | static constexpr long long SCALER = 1 << 12; //* 29 | static constexpr long long OFFSETTER = 1 << 13; //+ 30 | static constexpr long long DEOFFSETTER = 1 << 14; //+ 31 | 32 | static constexpr long long CONTENT = 1 << 15; //any childs owner 33 | static constexpr long long LABEL = 1 << 16; 34 | 35 | static constexpr long long FLOW = 1 << 17; //ret, jmp 36 | static constexpr long long CALL = 1 << 18; // calls 37 | 38 | //RULES 39 | static constexpr long long ALL_ARGS_SAME_SIZE = 1 << 19; //this means that all args on the OPCODE must be same size 40 | static constexpr long long OPTIONAL = 1 << 20; 41 | static constexpr long long INF = 1 << 21; 42 | static constexpr long long UN_ORDERED = 1 << 22; 43 | static constexpr long long END_OF_FUNCTION = 1 << 23; 44 | static constexpr long long START_OF_FUNCTION = 1 << 24; 45 | static constexpr long long END_OF_LOOP = 1 << 25; 46 | static constexpr long long NEEDS_SIZE_IDENTIFIER = 1 << 26; 47 | static constexpr long long SIZE_INDENTIFIER = 1 << 27; 48 | 49 | static constexpr long long GLOBAL_LABEL = 1 << 28; 50 | static constexpr long long SET_DATA = 1 << 29; 51 | static constexpr long long GLOBAL_VARIABLE = 1 << 30; 52 | static constexpr long long STRING = (long long)1 << 31; 53 | static constexpr long long ADD_NON_VOLATILE_SPACE_NEEDS_HERE = (long long)1 << 32; 54 | static constexpr long long POSITION_INDEPENDENT_REGISTER = (long long)1 << 33; 55 | static constexpr long long STACK_ALLOCATION_CONSTANT = (long long)1 << 34; 56 | static constexpr long long UN_DECIDED = (long long)1 << 35; 57 | static constexpr long long PARAMETER_SPACE = (long long)1 << 36; 58 | static constexpr long long PUSH_SPACE = (long long)1 << 37; 59 | static constexpr long long LOCAL_VARIABLE_SCOPE = (long long)1 << 38; 60 | static constexpr long long REGISTER_SAVE_SPACE = (long long)1 << 39; 61 | static constexpr long long CALL_PARAMETER_SPACE = (long long)1 << 40; 62 | static constexpr long long ALREADY_GIVEN_REGISTER_NAME = (long long)1 << 41; 63 | static constexpr long long SECTION = (long long)1 << 42; 64 | 65 | //This is for the Assembler to identify end of opcode args, before Parser phase. 66 | static constexpr long long NEWLINE = (long long)1 << 43; 67 | static constexpr long long OPCODE = (long long)1 << 44; 68 | 69 | static constexpr long long UNIFORM_REGISTER = (long long)1 << 45; 70 | static constexpr long long EXTENDED_REGISTER = (long long)1 << 46; 71 | } 72 | 73 | namespace Flags{ 74 | //the main flags that LEXER uses 75 | static constexpr long KEYWORD_COMPONENT = 1 << 0; 76 | static constexpr long UNDEFINED_COMPONENT = 1 << 1; 77 | static constexpr long PAREHTHESIS_COMPONENT = 1 << 2; 78 | static constexpr long END_COMPONENT = 1 << 3; 79 | static constexpr long STRING_COMPONENT = 1 << 4; 80 | static constexpr long NUMBER_COMPONENT = 1 << 5; 81 | static constexpr long COMMENT_COMPONENT = 1 << 6; 82 | static constexpr long OPERATOR_COMPONENT = 1 << 7; 83 | static constexpr long TEXT_COMPONENT = 1 << 8; 84 | static constexpr long END_OF_DIRECTIVE_CHANGING_FILE = 1 << 9; 85 | static constexpr long TEMPLATE_COMPONENT = 1 << 10; 86 | static constexpr long NUMERICAL_TYPE_COMPONENT = 1 << 11; 87 | static constexpr long PROCESSED_STRING = 1 << 12; 88 | } 89 | 90 | enum Node_Type { 91 | CONTENT_NODE, 92 | ELSE_IF_NODE, 93 | ELSE_NODE, 94 | IF_NODE, 95 | WHILE_NODE, 96 | FUNCTION_NODE, 97 | CALL_NODE, 98 | PROTOTYPE, 99 | IMPORT, 100 | EXPORT, 101 | FLOW_NODE, 102 | PTR_NODE, 103 | NUMBER_NODE, 104 | 105 | OPERATOR_NODE, //classical operators like +-/*^ 106 | ASSIGN_OPERATOR_NODE, 107 | CONDITION_OPERATOR_NODE, //==, !=, <, > 108 | BIT_OPERATOR_NODE, // &, |, ¤, <<, >> 109 | LOGICAL_OPERATOR_NODE, 110 | ARRAY_NODE, //a[1] 111 | NODE_CASTER, //fruit x->banana.a 112 | 113 | STRING_NODE, 114 | CLASS_NODE, 115 | OBJECT_NODE, 116 | PARAMETER_NODE, 117 | ANY, 118 | TEMPLATE_NODE, 119 | KEYWORD_NODE, 120 | PREFIX_NODE, 121 | POSTFIX_NODE, 122 | OBJECT_DEFINTION_NODE, 123 | LABEL_NODE, 124 | NAMESPACE_INLINE_NODE, 125 | COUNT, 126 | 127 | COEFFICIENT_NODE, 128 | }; 129 | 130 | #endif -------------------------------------------------------------------------------- /H/Lexer/Component.h: -------------------------------------------------------------------------------- 1 | #ifndef _COMPONENT_H_ 2 | #define _COMPONENT_H_ 3 | #include 4 | #include 5 | #include "Position.h" 6 | #include "../Flags.h" 7 | using namespace std; 8 | 9 | class Node; 10 | 11 | class Component 12 | { 13 | public: 14 | string Value; 15 | vector Components; // Tokens 16 | Node* node = nullptr; 17 | Position Location; // LineNumber 18 | long Flags; 19 | Component(string value, long flags) : Value(value), Flags(flags) {} 20 | Component(string value, const Position& position, long flags) : Value(value), Location(position), Flags(flags) {} 21 | Component(string value, long flag, vector C): Value(value), Components(C), Flags(flag) {} 22 | bool is(long flag) 23 | { 24 | return (Flags & flag) == flag; 25 | } 26 | bool Has(vector f) { 27 | for (auto i : f) 28 | if (is(i)) 29 | return true; 30 | return false; 31 | } 32 | vector Get_all() { 33 | vector Result; 34 | 35 | Result.push_back(this); 36 | 37 | for (auto& i : Components) { 38 | vector tmp = i.Get_all(); 39 | Result.insert(Result.end(), tmp.begin(), tmp.end()); 40 | } 41 | 42 | return Result; 43 | } 44 | string To_String() { 45 | string Result = Value; 46 | 47 | char End = 0; 48 | 49 | if (Value[0] == '(' || Value[0] == '{' || Value[0] == '[' || Value[0] == '<') { 50 | Result = Value[0]; 51 | 52 | if (Result[0] == '(') 53 | End = ')'; 54 | else 55 | End = Result[0] + 2; 56 | } 57 | 58 | for (auto i : Components) { 59 | Result += i.To_String(); 60 | } 61 | 62 | if (End != 0) 63 | Result += End; 64 | 65 | 66 | return Result; 67 | } 68 | Component* Copy_Component(); 69 | }; 70 | 71 | #endif -------------------------------------------------------------------------------- /H/Lexer/Lexer.h: -------------------------------------------------------------------------------- 1 | #ifndef _LEXER_H_ 2 | #define _LEXER_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include "Component.h" 8 | #include "..//Flags.h" 9 | 10 | namespace Lexer 11 | { 12 | extern char SingleLineCommentIdentifier; 13 | extern char StringIdentifier; 14 | extern char DecimalSeparator; 15 | extern char ExponentSeparator; 16 | 17 | extern vector Operators; 18 | extern vector Keywords; 19 | 20 | extern vector GetComponentsFromFile(string file); 21 | extern vector GetComponents(string text); 22 | extern Component GetComponent(string text); 23 | } 24 | 25 | #endif -------------------------------------------------------------------------------- /H/Lexer/Position.h: -------------------------------------------------------------------------------- 1 | #ifndef _POSITION_H_ 2 | #define _POSITION_H_ 3 | 4 | #include 5 | 6 | using namespace std; 7 | 8 | class Position 9 | { 10 | public: 11 | int Line = 0; 12 | int Character = 0; 13 | int Local = 0; 14 | int Absolute = 0; 15 | const char* File_Name = ""; 16 | 17 | Position(int line = 0, int character = 0, int local = 0, int absolute = 0); 18 | 19 | int GetLine() const 20 | { 21 | return Line; 22 | } 23 | 24 | const char* GetFilePath() const { 25 | return File_Name; 26 | } 27 | 28 | int GetCharacter() const 29 | { 30 | return Character; 31 | } 32 | 33 | int GetLocal() const { 34 | return Local; 35 | } 36 | 37 | int GetAbsolute() const 38 | { 39 | return Absolute; 40 | } 41 | 42 | int GetFriendlyLine() const 43 | { 44 | return Line + 1; 45 | } 46 | 47 | int GetFriendlyCharacter() const 48 | { 49 | return Character + 1; 50 | } 51 | 52 | int GetFriendlyAbsolute() const 53 | { 54 | return Absolute + 1; 55 | } 56 | 57 | Position& NextLine() 58 | { 59 | Line++; 60 | Character = 0; 61 | Local++; 62 | Absolute++; 63 | return *this; 64 | } 65 | 66 | Position& NextCharacter() 67 | { 68 | Character++; 69 | Absolute++; 70 | Local++; 71 | return *this; 72 | } 73 | 74 | Position Clone() const 75 | { 76 | return Position(Line, Character, Local, Absolute); 77 | } 78 | 79 | string ToString() const 80 | { 81 | return (string(File_Name) + ":" + to_string(GetFriendlyLine()) + ":" + to_string(GetFriendlyCharacter())); 82 | } 83 | 84 | int GetFileIndex(); 85 | }; 86 | 87 | #endif -------------------------------------------------------------------------------- /H/Linker/Linker.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINKER_H_ 2 | #define _LINKER_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include "../Assembler/Assembler_Types.h" 8 | #include "../Docker/OBJ.h" 9 | 10 | using namespace std; 11 | 12 | class Linker{ 13 | public: 14 | 15 | static void En_Large_PE_Header(PE::PE_OBJ* obj); 16 | static void Update_Obj_Headers(PE::PE_OBJ* obj); 17 | static void Inline_Relocations(PE::PE_OBJ* obj); 18 | 19 | static vector Write_PE_Executable(PE::PE_OBJ* obj); 20 | 21 | static void Add_Export_Table(PE::PE_OBJ* obj, int expected_section_count); 22 | static void Add_Import_Table(PE::PE_OBJ* obj, int expected_section_count); 23 | static void Add_Import_Address_Table(PE::PE_OBJ* obj); 24 | 25 | static void Write_Export_Table(PE::PE_OBJ* obj, vector& Buffer); 26 | static void Write_Import_Table(PE::PE_OBJ* obj, vector& Buffer); 27 | static void Write_Import_Address_Table(PE::PE_OBJ* obj, vector& Buffer); 28 | 29 | static PE::Export_Table* Read_Export_Table(PE::Section& s, vector& Buffer); 30 | static PE::Import_Table* Read_Import_Table(PE::Section& s, vector& Buffer); 31 | 32 | }; 33 | 34 | #endif -------------------------------------------------------------------------------- /H/Nodes/IR.h: -------------------------------------------------------------------------------- 1 | #ifndef _IR_H_ 2 | #define _IR_H_ 3 | #include "Token.h" 4 | #include "../Lexer/Position.h" 5 | #include 6 | #include 7 | 8 | using namespace std; 9 | 10 | class Structure { 11 | public: 12 | Token* Type = nullptr; 13 | int Min_Size = 0; 14 | int Max_Size = 0; 15 | 16 | Structure(Token* t, int mins, int maxs) { 17 | Type = t; 18 | Min_Size = mins; 19 | Max_Size = maxs; 20 | } 21 | }; 22 | 23 | enum class OPCODE_ENCODING { 24 | NaN, 25 | 26 | RMI, 27 | 28 | MR, 29 | RM, 30 | FD, 31 | TD, 32 | OI, 33 | MI, 34 | ZO, 35 | 36 | M, 37 | R, 38 | I, 39 | A, 40 | B, 41 | C, 42 | D, 43 | O 44 | }; 45 | 46 | class Pattern { 47 | public: 48 | vector Order; 49 | int ID = 0; 50 | OPCODE_ENCODING Encoding = OPCODE_ENCODING::NaN; 51 | int Post_Fix = 0; 52 | int Pre_Fix = 0; 53 | 54 | int Smallest_Size = 0; 55 | int Largest_Size = 0; 56 | 57 | bool Defaults_To_64 = false; 58 | 59 | Pattern(vector order, int id = 0, OPCODE_ENCODING en = OPCODE_ENCODING::NaN, int post = 0, int pre_fix = 0, bool defaults_to_64 = false) { 60 | Order = order; 61 | ID = id; 62 | Encoding = en; 63 | Post_Fix = post; 64 | Pre_Fix = pre_fix; 65 | Defaults_To_64 = defaults_to_64; 66 | } 67 | }; 68 | 69 | class IR { 70 | public: 71 | //[Token:OPC] [Token:arg], [Token:arg], [Token:arg] 72 | Token* OPCODE = nullptr; 73 | string Intermediate_Alias = ""; 74 | Position* Location; 75 | 76 | vector Arguments; 77 | //Type, min_-size, max_size, Base_Opcode_id 78 | //vector, int>>>> Order; 79 | vector Order; 80 | vector (*Complex)(vector) = nullptr; 81 | 82 | IR(Position* p) : Location(p){} 83 | IR(Token* opc, vector args, Position* p) : OPCODE(opc), Arguments(args), Location(p) { } 84 | IR(string id, Token* opc, vector args, Position* p) : Intermediate_Alias(id), OPCODE(opc), Arguments(args), Location(p) {} 85 | IR(string id, Token* opc, vector order) : Intermediate_Alias(id), OPCODE(opc), Order(order) {Tell_Smallest_And_Largest_Sizes();} 86 | IR(string id, Token* opc, vector (*c)(vector), Position* p) : Intermediate_Alias(id), OPCODE(opc), Complex(c), Location(p) {} 87 | IR(string id, Token* opc, vector order, vector (*c)(vector)) : Intermediate_Alias(id), OPCODE(opc), Order(order), Complex(c) {Tell_Smallest_And_Largest_Sizes();} 88 | 89 | bool is(long long flag) { return OPCODE->is(flag); } 90 | vector Get_All(long long F) 91 | { 92 | vector Result; 93 | for (auto i : Arguments) { 94 | vector Tmp = i->Get_All(F); 95 | Result.insert(Result.begin(), Tmp.begin(), Tmp.end()); 96 | } 97 | if (OPCODE) { 98 | vector Tmp = OPCODE->Get_All(F); 99 | Result.insert(Result.begin(), Tmp.begin(), Tmp.end()); 100 | } 101 | 102 | return Result; 103 | } 104 | 105 | vector Get_All(vector flags) 106 | { 107 | vector Result; 108 | 109 | for (auto i : Arguments) { 110 | vector Tmp = i->Get_All(flags); 111 | Result.insert(Result.begin(), Tmp.begin(), Tmp.end()); 112 | } 113 | if (OPCODE){ 114 | vector Tmp = OPCODE->Get_All(flags); 115 | Result.insert(Result.begin(), Tmp.begin(), Tmp.end()); 116 | } 117 | 118 | return Result; 119 | } 120 | 121 | void Tell_Smallest_And_Largest_Sizes(){ 122 | 123 | int Smallest = _SYSTEM_BIT_SIZE_; 124 | int Largest = 0; 125 | 126 | for (auto& i : Order){ 127 | for (auto& j : i.Order){ 128 | if (j.Min_Size < Smallest) Smallest = j.Min_Size; 129 | if (j.Max_Size > Largest) Largest = j.Max_Size; 130 | } 131 | } 132 | 133 | //Now that we know the largest and smallest sizes, we tell each order that information to the for them to hold into that informatino for later use. 134 | for (auto& i : Order){ 135 | i.Largest_Size = Largest; 136 | i.Smallest_Size = Smallest; 137 | } 138 | } 139 | 140 | }; 141 | 142 | #endif -------------------------------------------------------------------------------- /H/Nodes/Token.h: -------------------------------------------------------------------------------- 1 | #ifndef _TOKEN_H_ 2 | #define _TOKEN_H_ 3 | #include "../Flags.h" 4 | #include "Node.h" 5 | 6 | #include 7 | #include 8 | 9 | using namespace std; 10 | 11 | //memory(handle, operator(offsetter), num(12)) 12 | class Token{ 13 | public: 14 | 15 | string Name = ""; 16 | 17 | long long Flags = 0; 18 | int Life_Span = 0; 19 | int Size = 0; 20 | bool Has_Floating_Point_Value = false; 21 | vector> Resources; 22 | vector>>> Combinations; 23 | 24 | Node* Parent = nullptr; 25 | string OG = ""; //REG_a_Parameter og is a 26 | //for return 27 | bool Is_Initted = false; 28 | //for register parents 29 | Token* Holder = nullptr; 30 | //for parameters 31 | int Parameter_Index = -1; 32 | //for numeric or something elses usable types. 33 | vector Usable_Types; 34 | //for memory 35 | vector Childs; //here resides registers, constants, scalers, offsetters. 36 | //for call handling 37 | vector Parameters; //this contains information about the parameters. 38 | //scaler/offsetter 39 | Token* Left = nullptr; 40 | Token* Right = nullptr; 41 | 42 | Token* ID = nullptr; 43 | unsigned char XReg = 0; 44 | union{ 45 | //X86_64 46 | MODRM_ENCODING Encoding = MODRM_ENCODING::NON; 47 | }; 48 | //for tokens 49 | Token(const Token& t, long long f) { *this = t; Flags = f; } 50 | Token(const Token& t, int s) { *this = t; Size = s; } 51 | Token(long long f) : Flags(f) { } 52 | Token(Node* n, bool Skip_Needed_Address_Protocol = false); 53 | Token(long long f, int s) : Flags(f), Size(s) { } 54 | Token(long long f, string n) : Flags(f), Name(n) { } 55 | Token(long long f, string n, vector Param) : Flags(f), Name(n), Parameters(Param) { } 56 | Token(long long f, string n, int s) : Flags(f), Name(n), Size(s) { } 57 | Token(long long f, string n, int s, Node* Scope) : Flags(f), Name(n), Size(s), Parent(Scope) { } 58 | Token(long long f, string n, int s, vector c, unsigned char xreg = 0) : Flags(f), Name(n), Size(s), Childs(c), XReg(xreg) { 59 | if (!Has({TOKEN::NONVOLATILE, TOKEN::VOLATILE, TOKEN::QUOTIENT, TOKEN::REMAINDER, TOKEN::RETURNING, TOKEN::PARAMETER})) 60 | return; 61 | for (auto i : Childs) { 62 | i->Holder = this; 63 | } 64 | 65 | } 66 | Token(long long f, string n, Token* L, Token* R) : Flags(f), Name(n), Left(L), Right(R){} 67 | 68 | Token(long long f, string n, string o) : Flags(f), Name(n), OG(o) {} 69 | Token(long long f, string n, string o, vector Param) : Flags(f), Name(n), Parameters(Param), OG(o) {} 70 | Token(long long f, string n, string o, int s) : Flags(f), Name(n), Size(s), OG(o) {} 71 | Token(long long f, string n, string o, int s, vector c) : Flags(f), Name(n), Size(s), Childs(c), OG(o) { 72 | if (!is(TOKEN::REGISTER) && !is(TOKEN::VOLATILE) && !is(TOKEN::NONVOLATILE) && !is(TOKEN::RETURNING)) 73 | return; 74 | for (auto i : Childs) { 75 | i->Holder = this; 76 | } 77 | } 78 | 79 | Token(long long f, vector c) : Flags(f), Childs(c) {} 80 | Token(long long f, vector c, int s) : Flags(f), Childs(c), Size(s) {} 81 | Token(long long f, vector c, int s, string n) : Flags(f), Childs(c), Size(s), Name(n) {} 82 | Token(long long f, vector c, int s, string n, Node* p) : Flags(f), Childs(c), Size(s), Name(n), Parent(p) {} 83 | Token(long long f, vector ut, string id) : Flags(f), Usable_Types(ut), Name(id) {} 84 | 85 | Token(long long f, vector> Res) : Flags(f), Resources(Res) {} 86 | Token(long long f, vector> Res, string id) : Flags(f), Resources(Res), Name(id) {} 87 | 88 | Token(long long f, vector>>> comb) : Flags(f), Combinations(comb){} 89 | 90 | //void 91 | 92 | Token* Get_Child(int s) { 93 | if (this->Size != s) 94 | return Childs[0]->Get_Child(s); 95 | return nullptr; 96 | } 97 | vector* Get_Childs() { return &Childs; } 98 | bool is(long long flag){return (Flags & flag) == flag;} 99 | bool is(vector f) { 100 | for (auto i : f) 101 | if (!is(i)) 102 | return false; 103 | return true; 104 | } 105 | bool Any(long long flags){return (Flags & flags) != 0;} 106 | void add(long long flag){this->Flags |= flag;} 107 | void remove(long long flag){this->Flags ^= (Flags & flag);} 108 | int Get_Size() { return Size; } 109 | long long Get_Flags() { return Flags; } 110 | void Set_Flags(long long f) { Flags = f; } 111 | string Get_Name() { 112 | if (this->is(TOKEN::MEMORY)) 113 | if (Childs[0]->is(TOKEN::OFFSETTER) || Childs[0]->is(TOKEN::DEOFFSETTER)) 114 | return Childs[0]->Left->Get_Name() + "_" + Childs[0]->Right->Get_Name(); 115 | else 116 | return Childs[0]->Name; 117 | return Name; 118 | } 119 | void Set_Name(string n) { Name = n; } 120 | void Set_Parent(Node* p) { Parent = p; } 121 | void Set_Size(int s) { Size = s; } 122 | Node* Get_Parent() { return Parent; } 123 | Token* Get_Size_Parent(int s, Token* t) { 124 | if (t->Get_Size() == s) 125 | return t; 126 | //for (auto i : t->Childs) 127 | // if (Get_Size_Parent(s, i) != nullptr) 128 | // return Get_Size_Parent(s, i); 129 | if (t->Holder != nullptr) 130 | return Get_Size_Parent(s, t->Holder); 131 | return nullptr; 132 | } 133 | vector Get_Connected_Registers(Token* r) { 134 | vector Result; 135 | Token* tmp_parent = r->Holder; 136 | while (tmp_parent != nullptr) { 137 | Result.push_back(tmp_parent); 138 | tmp_parent = tmp_parent->Holder; 139 | } 140 | vector tmp = Get_All_Childs(r); 141 | Result.insert(Result.end(), tmp.begin(), tmp.end()); 142 | return Result; 143 | } 144 | vector Get_All_Childs(Token* r) { 145 | vector Result; 146 | Result.push_back(r); 147 | for (auto i : r->Childs) { 148 | vector tmp = Get_All_Childs(i); 149 | Result.insert(Result.end(), tmp.begin(), tmp.end()); 150 | } 151 | return Result; 152 | } 153 | bool Has(long long F) { 154 | if (is(F) || (ID && ID->is(F))) 155 | return true; 156 | for (auto i : Childs) 157 | return i->Has(F); 158 | if (Left != nullptr && Left->Has(F)) 159 | return true; 160 | if (Right != nullptr && Right->Has(F)) 161 | return true; 162 | return false; 163 | } 164 | bool Has(vector F) { 165 | for (auto i : F) { 166 | if (Has(i)) 167 | return true; 168 | } 169 | return false; 170 | } 171 | vector Get_All(vector F); 172 | vector Get_All(long long F); 173 | vector Get_All(); 174 | }; 175 | 176 | #endif -------------------------------------------------------------------------------- /H/Parser/Algebra.h: -------------------------------------------------------------------------------- 1 | #ifndef _ALGEBRA_H_ 2 | #define _ALGEBRA_H_ 3 | 4 | #include "../Nodes/Node.h" 5 | 6 | #include 7 | 8 | using namespace std; 9 | 10 | class Algebra { 11 | public: 12 | vector* Input = nullptr; 13 | Algebra(Node* parent) : Scope(parent) {} 14 | Algebra(Node* parent, vector* in) : Input(in), Scope(parent) { Start_Factory(); } 15 | 16 | void Start_Factory(); 17 | private: 18 | Node* Scope; 19 | 20 | static void Factory(Node*& n); 21 | 22 | //Function inlining tools 23 | void Set_Return_To_Jump(Node* n, Node* Return_Value, Node* end); 24 | void Function_Inliner(Node* c, int i); 25 | Node* Get_Other_Pair(Node* ast, Node* other); 26 | bool Is_Untrustworthy(Node* v); 27 | 28 | //Number factorisation 29 | void Exponent_Factorisation(Node*& n); 30 | 31 | //Multiplication and potense handle functions 32 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ 33 | static void Potens_And_Multiplication(Node*& Operator); 34 | static void Replace_Node(Node* Current, Node* New); 35 | static void Remove_As_Much(Node** n, string Name, int& count); 36 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ 37 | 38 | //This function takes two nodes and multiplies them together. 39 | static void Multiply_Nodes(Node*& x, Node*& y); 40 | 41 | //Decompress the operators into AST 42 | static string De_Compress_Operators(Node* Coefficient); 43 | 44 | //This function is used to combine two ajacents numbers. 45 | static void Combine_Numbers(Node*& n); 46 | 47 | //This function combines numbers that are not adjacent to each other. 48 | //Nonetheless this function still needs to go by the mathematical rules. 49 | static void Combine_Non_Adjacent_Variables(Node*& n); 50 | 51 | //This function takes two Number nodes, and goes through the context AST tree, to see were they have the same context node. 52 | //after knowing this result, it will return the both paths to the context node. 53 | static void Get_Context_Paths(Node* n1, Node* n2, vector& path1, vector& path2); 54 | 55 | //This function will go through the AST tree, and find the first node that has the same context node. 56 | static vector* Get_Path(Node* n, Node* Context); 57 | 58 | //Inlining functions 59 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ 60 | static void Run_Variable_Inliner(Node* n); 61 | static void Update_Inline_Content(Node* n); 62 | static bool Has_Inlining_Value(Node* n); 63 | static void Inline_Variable(Node*& n); 64 | static Node** Interpreter_Value(Node* n); 65 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ 66 | }; 67 | 68 | #endif -------------------------------------------------------------------------------- /H/Parser/Analyzer.h: -------------------------------------------------------------------------------- 1 | #ifndef _ANALYZER_H_ 2 | #define _ANALYZER_H_ 3 | 4 | #include "../Nodes/Node.h" 5 | #include "../UI/Usr.h" 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | using namespace std; 12 | 13 | extern Node* Global_Scope; 14 | extern Usr* sys; 15 | 16 | class Analyzer { 17 | private: 18 | vector Start_Of_Proccesses; 19 | public: 20 | 21 | void Factory(); 22 | 23 | void Detect_Abnormal_Start_Address(); 24 | void List_All_Exported(); 25 | 26 | //class tools 27 | void Analyze_Class(Node* c); 28 | 29 | //Function tools 30 | void Calling_Count_Incrementer(Node* f, vector& Callin_Trace); 31 | void Call_Algebra(Node* n); 32 | void Analyze_Variable_Address_Pointing(Node* v, Node* n); 33 | int Get_Amount(string t, Node* n); 34 | void Define_Sizes(Node* p); 35 | 36 | void Dependency_Injector(vector& nodes); 37 | 38 | void Give_Global_Scope_All_Used_Functions(); 39 | 40 | void Calculate_Address_Givers_For_Functions(Node* f); 41 | 42 | }; 43 | 44 | #endif -------------------------------------------------------------------------------- /H/Parser/Memory_Manager.h: -------------------------------------------------------------------------------- 1 | #ifndef __MEMORY_MANAGER_H_ 2 | #define __MEMORY_MANAGER_H_ 3 | 4 | #include 5 | 6 | #include "../Nodes/Node.h" 7 | #include "../UI/Safe.h" 8 | 9 | class Memory_Manager { 10 | public: 11 | Node* Scope; 12 | 13 | Memory_Manager(Node* S) { 14 | Scope = S; 15 | Factory(); 16 | } 17 | private: 18 | void Factory(); 19 | void Manage_Function(); 20 | 21 | //Class modifiers 22 | void Manage_Class_Padding(); 23 | void Manage_Class_Re_Order(); 24 | void Re_Order_Vector(vector& list); 25 | }; 26 | 27 | #endif -------------------------------------------------------------------------------- /H/Parser/Parser.h: -------------------------------------------------------------------------------- 1 | #ifndef _PARSER_H_ 2 | #define _PARSER_H_ 3 | 4 | #include "../../H/Flags.h" 5 | #include "../Lexer/Component.h" 6 | #include "../Nodes/Node.h" 7 | 8 | #include 9 | #include 10 | 11 | using namespace std; 12 | 13 | class Parser 14 | { 15 | public: 16 | Parser(Node* p) : Scope(p){} 17 | ~Parser(){} 18 | Node* Scope = nullptr; 19 | vector Input; 20 | vector Get_Inheritting_Components(int i); 21 | vector Get_Amount_Of(unsigned int i, long Flag, bool All_in_Same_Line = true); 22 | vector Get_Amount_Of(unsigned int i, vector Flags, bool All_in_Same_Line = true); 23 | 24 | bool Dont_Give_Error_On_Templates = false; 25 | 26 | //POST-PREPROSESSOR PATTERNS 27 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- 28 | void Combine_Dot_In_Member_Functions(int& i); 29 | void Template_Pattern(int& i); 30 | void Construct_Virtual_Class_To_Represent_Multiple_Template_Inputs(Component& i); 31 | void Operator_Combinator(int i); 32 | void Nodize_Template_Pattern(int i); 33 | void Template_Type_Constructor(int i); 34 | vector Template_Function_Constructor(Node* Func, vector T_Arg, vector T_Type); 35 | void Inject_Template_Into_Member_Function_Fetcher(int& i); 36 | 37 | //Include parsers 38 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- 39 | void Combine_Import_Shattered_Return_Info(int i); //import func ptr 4 integer 40 | void Import_Pattern(int i); //import func new(int amount)\n 41 | 42 | 43 | //Comment hazard 44 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- 45 | void Combine_Comment(int i); 46 | void Remove_All_Excess_Comments(int i); 47 | 48 | //PATTERNS 49 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- 50 | void Definition_Pattern(int i); //test ptr a 51 | void Constructor_Pattern(int i); //foo ptr foo(foo ptr){..} 52 | void Prototype_Pattern(int i); //int main()\n 53 | void Object_Pattern(int i); //a 54 | void This_Pattern(int i); //this is for member function uninitialized this parameter 55 | void Complex_Cast(int i); 56 | void Parenthesis_Pattern(int i); //(a + a) * b 57 | void Math_Pattern(int& i, vector Operator, int Flag, bool Change_Index = false); //a = b + c * d, a.b.c.d() 58 | static int Get_Number_Size(long long Value); 59 | void Number_Pattern(int i); //123 60 | void Operator_PreFix_Pattern(int i, vector Prefix); //++a/--b() 61 | void Operator_PostFix_Pattern(int i, vector Postfix);//a++/b()-- 62 | void Variable_Negate_Pattern(int i); //-a, -b() 63 | void Callation_Pattern(int i); //b(a, b, c, d) 64 | void Array_Pattern(int i); //a[1]/b[a] 65 | void Function_Pattern(int i, Node* Class = nullptr); //func int ptr f(int x) {..} 66 | void Type_Pattern(int i); //type [inheritted] foo{member 1,} 67 | void Member_Pattern(int i); //Dot operator is in Operator_Pattern() 68 | void If_Pattern(int i); //patternises the condition nodes 69 | void Else_Pattern(int i); 70 | void Return_Pattern(int i); //return 1/ return; 71 | void Jump_Pattern(int i); //jump test 72 | void Label_Pattern(int i); 73 | void Label_Definition(int i); 74 | void Break_Pattern(int i); 75 | void Continue_Pattern(int i); 76 | void Size_Pattern(int i); //if (contidion){..} 77 | void Format_Pattern(int i); //format = decimal 78 | void Member_Function_Pattern(int i); //return_type class_name.funcname(){} 79 | 80 | //String handlers 81 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- 82 | void String_Pattern(int i); //"abc" 83 | 84 | //Pattern Users 85 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- 86 | void Operator_Order(); 87 | void Factory(); 88 | 89 | //Namespace patterns 90 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- 91 | void Use_Pattern(int i); 92 | 93 | //Complex Cast 94 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- 95 | Component* Construct_Virtual_Class_For_Complex_Cast(Component Parenthesis); 96 | 97 | //SSS System 2000 parser utilities lol 98 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- 99 | void Factory_SSS(); 100 | void Parse_SSS_Scope(int i); 101 | void Parse_SSS_List_Element(int i); 102 | 103 | private: 104 | }; 105 | 106 | #endif 107 | 108 | -------------------------------------------------------------------------------- /H/Parser/PostProsessor.h: -------------------------------------------------------------------------------- 1 | #ifndef _POSTPROSESSOR_H_ 2 | #define _POSTPROSESSOR_H_ 3 | 4 | #include "../Lexer/Component.h" 5 | #include "../Flags.h" 6 | #include "../Nodes/Node.h" 7 | #include "Algebra.h" 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | using namespace std; 14 | 15 | class PostProsessor 16 | { 17 | private: 18 | bool Ignore_Scope_Defined = false; 19 | public: 20 | vector Components; 21 | vector Input; 22 | vector Output; 23 | Node* Scope = nullptr; 24 | 25 | PostProsessor(Node* p) : Scope(p){} 26 | PostProsessor(Node* p, vector in) : Scope(p), Input(in) { Factory(); } 27 | PostProsessor(Node* p, vector in, bool ignore_Scope_Defined = false) { 28 | Ignore_Scope_Defined = ignore_Scope_Defined; 29 | Scope = p; 30 | for (auto **i : in) { 31 | Input.push_back(*i); 32 | } 33 | Factory(); 34 | 35 | for (int i = 0; i < in.size(); i++) { 36 | *in[i] = Input[i]; 37 | } 38 | } 39 | PostProsessor(Node* p, vector in) : Scope(p), Components(in) { Factory(); } 40 | PostProsessor(){} 41 | ~PostProsessor(){} 42 | 43 | void Factory(); 44 | void Transform_Component_Into_Node(); //transfer the components into pure nodes 45 | 46 | //Import handlers 47 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- 48 | void Type_Size_Definer(Node* t); 49 | void Handle_Imports(Node* i); //here we can redefine the types given to parameters. 50 | Node* Construct_Node_From_Numerical_Info(Node* n, Node_Type Flag); 51 | 52 | //Class handlers 53 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- 54 | void Type_Definer(Node* t); //defines all the members of type 55 | void Destructor_Generator(Node* Type); //creates the destructor pipeline 56 | void Destructor_Caller(Node* v, vector& childs); 57 | void Member_Function_Defined_Outside(Node* f); //puts the func into parenting type class 58 | void Member_Function_Defined_Inside(Node* f); // 59 | void Update_Template_Member_Members(Node* f, Node* Class); 60 | 61 | //Namespace handlers 62 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- 63 | void Open_Namespace_For_Prosessing(Node* n); 64 | 65 | 66 | //void Combine_Conditions(int i); //combines the if and else 67 | void Open_Function_For_Prosessing(Node* f); //just opens the functions insides for post prosessor. 68 | void Open_Condition_For_Prosessing(int i); //just opens the condition insides for post prosessor. 69 | void Open_Paranthesis(int i); //(..) 70 | 71 | //Sanitizers 72 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- 73 | void Reduntant_Paranthesis_Cleaner(int i); 74 | 75 | //Callation handlers 76 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- 77 | void Open_Call_Parameters_For_Prosessing(int i);//open the calls parameters to do postprosessing 78 | vector> Find_Suitable_Function_Candidates(Node* caller, bool Skip_Name_Comparison, bool Use_All_Scopes); 79 | map, Node*>>> Order_By_Accuracy(vector> Candidates, Node* Caller); 80 | int Choose_Most_Suited_Function_Candidate(map, Node*>>> Candidates, Node* Caller, bool Is_Func_Ptr); 81 | int Get_Casting_Distance(Node* a, Node* b, bool Layer = false); 82 | bool Find_Castable_Inheritance(vector types, string target); 83 | void Find_Call_Owner(Node* n, bool Stop = true); //justifyes the fucntion to call 84 | void Upscale_Number_Parameter_Sizes(Node* caller); 85 | 86 | 87 | //Misc 88 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- 89 | void Combine_Member_Fetching(Node*& n); //combines the fether into the fetching member 90 | void Define_Sizes(Node* p); //defines sizes of every type that the parent has init. 91 | void Combine_Condition(int i); //combines the ifs and elses 92 | void Determine_Return_Type(int i); //open the operator and determined the types basen on the left and right side 93 | void Determine_Array_Type(int i); // 94 | void Open_PreFix_Operator(int i); 95 | void Open_PostFix_Operator(int i); 96 | void Open_Loop_For_Prosessing(int i); 97 | void Update_Used_Object_Info(Node* n); 98 | 99 | Node* Get_From_AST(Node* n); 100 | 101 | void Operator_Overload(int i); //makes new instance of using different operators 102 | 103 | int Get_Amount(string t, Node* n); 104 | 105 | void Change_Local_Strings_To_Global_Pointters(int i); 106 | 107 | void Move_Global_Varibles_To_Header(int& i); 108 | 109 | bool Check_If_Template_Function_Is_Right_One(Node* t, Node* c); 110 | 111 | void Open_Safe(vector n); 112 | 113 | void Update_Operator_Inheritance(Node* n); 114 | void Update_Inheritance(Node* n); 115 | void Analyze_Return_Value(Node* n); 116 | 117 | 118 | //String handlers 119 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- 120 | void Handle_String_Hexadecimals(Node* n); 121 | void Handle_String_Char_Numbers(Node* n); 122 | void Handle_Const_Char_Strings(Node* n); 123 | 124 | //Dot related 125 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- 126 | vector Insert_Dot(vector Childs, Node* Function, Node* This); 127 | vector Dottize_Inheritanse(Node* Class, Node* This, Node* Function); 128 | Node*& Get_Possible_Fetcher(Node*& n); 129 | void Go_Through_Un_Combined_Fetching(Node* n); 130 | 131 | void Cast(Node* n); 132 | void Increase_Calling_Number_For_Function_Address_Givers(Node* n); 133 | 134 | //Function Pointter 135 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- 136 | void Process_Function_Pointters(Node* Scope); 137 | 138 | //Number Handlers 139 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- 140 | void Handle_Numbers(Node* n); 141 | private: 142 | }; 143 | 144 | #endif -------------------------------------------------------------------------------- /H/PreProsessor/PreProsessor.h: -------------------------------------------------------------------------------- 1 | #ifndef _PREPROSESSOR_H_ 2 | #define _PREPROSESSOR_H_ 3 | 4 | #include "../Flags.h" 5 | #include "../Lexer/Component.h" 6 | #include "../Docker/Docker.h" 7 | #include "../UI/Usr.h" 8 | #include "../Docker/ASM.h" 9 | #include "../Docker/ELF.h" 10 | #include "../Docker/LIB.h" 11 | #include "../Docker/TXT.h" 12 | #include "../Docker/Mangler.h" 13 | 14 | #include 15 | 16 | using namespace std; 17 | 18 | class PreProsessor 19 | { 20 | public: 21 | PreProsessor(vector &list) : Input(list){} 22 | ~PreProsessor(){} 23 | void Factory(); 24 | void Include(int i); 25 | void Include(string filename); 26 | void If(int i); 27 | bool Calculate(vector); 28 | void Define_Const_Value(int i); 29 | void Replace_Const_Name_With_Value(vector &in); 30 | void Syntax_Correcter(vector symbols, string type, int i); 31 | void Detect_Directory_Usage_End(int i); 32 | void Detect_String_Macros(int i); 33 | //void Re_Arrnage_Components(); 34 | vector Linearise(vector& Tree); 35 | 36 | //std::map 37 | map Defined_Constants; 38 | vector& Input; 39 | private: 40 | }; 41 | 42 | #endif -------------------------------------------------------------------------------- /H/UI/Document_Request_Type.h: -------------------------------------------------------------------------------- 1 | #ifndef _DOCUMENT_REQUEST_TYPE_H_ 2 | #define _DOCUMENT_REQUEST_TYPE_H_ 3 | enum class Document_Request_Type 4 | { 5 | NONE, 6 | COMPLETIONS, 7 | SIGNATURES, 8 | DIAGNOSE, 9 | OPEN, 10 | DEFINITION, 11 | INFORMATION, 12 | FIND_REFERENCES, 13 | ASM 14 | }; 15 | 16 | #endif -------------------------------------------------------------------------------- /H/UI/Producer.h: -------------------------------------------------------------------------------- 1 | #ifndef _PRODUCER_H_ 2 | #define _PRODUCER_H_ 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | class Producer 9 | { 10 | public: 11 | Producer(vector IRs); 12 | }; 13 | 14 | 15 | #endif -------------------------------------------------------------------------------- /H/UI/Safe.h: -------------------------------------------------------------------------------- 1 | #ifndef __SAFE_H__ 2 | #define __SAFE_H__ 3 | 4 | #include "../Nodes/Node.h" 5 | #include "../Lexer/Position.h" 6 | #include 7 | #include 8 | #include 9 | #undef ERROR 10 | 11 | using namespace std; 12 | 13 | enum MSG_Type { 14 | NORMAL, 15 | ERROR, 16 | WARNING, 17 | SOLUTION, 18 | INFO, 19 | FAIL, 20 | SUCCESS, 21 | }; 22 | 23 | inline string SYNTAX_ERROR = "Syntax error"; 24 | inline string DEFINITION_ERROR = "Use of un-defined"; 25 | inline string MISSING_CAST = "Missing cast"; 26 | inline string ONLY_NUMBER_OPERATION = "Use of most left side of an operand as a number"; 27 | inline string MISSING_CRITICAL_INFORMATION = "Missing critical information"; 28 | inline string CANNOT_UNWRAP_PTR = "Cannot unwrap pointer"; 29 | inline string INVALID_OPERATION = "Invalid operation"; 30 | 31 | inline string ASSEMBLER_SYNTAX_ERROR = "Error in given assembly code"; 32 | 33 | inline string LINKER_MISSING_STARTING_FUNCTION = "Missing starting function"; 34 | inline string LINKER_INVALID_FILE = "Invalid file"; 35 | inline string LINKER_INTERNAL = "Internal linker error"; 36 | 37 | inline string SCRAPER_PROBLEM_READING = "Problem reading file"; 38 | 39 | inline string MISSING_DEFINITION = "Missing definition"; 40 | 41 | #define ERROR (MSG_Type)1 42 | #define NO 0 43 | #define YES 1 44 | #define IDK -1 45 | 46 | class Not_Found : public std::runtime_error{ 47 | public: 48 | Not_Found() : runtime_error("Not found"){} 49 | }; 50 | 51 | class Observation { 52 | public: 53 | Observation(MSG_Type t, string msg, Position p, string cause = "", int stop_On_Error = IDK) { 54 | //External message request. 55 | Type = t; 56 | Msg = msg; 57 | Pos = p; 58 | Cause = cause; 59 | Stop_On_Error = false; 60 | 61 | if (cause == "") 62 | Cause = Msg; 63 | 64 | if ((Type == ERROR || Type == FAIL) && (stop_On_Error == YES || stop_On_Error == IDK)) 65 | Stop_On_Error = true; 66 | else if (stop_On_Error == NO) 67 | Stop_On_Error = false; 68 | } 69 | 70 | Observation(MSG_Type t, string msg, string cause = "", int stop_On_Error = IDK) { 71 | //External message request. 72 | Type = t; 73 | Msg = msg; 74 | Pos = Position(-1, -1); 75 | Cause = cause; 76 | Stop_On_Error = false; 77 | 78 | if (cause == "") 79 | Cause = Msg; 80 | 81 | if ((Type == ERROR || Type == FAIL) && (stop_On_Error == YES || stop_On_Error == IDK)) 82 | Stop_On_Error = true; 83 | else if (stop_On_Error == NO) 84 | Stop_On_Error = false; 85 | } 86 | 87 | Observation(Observation& O, bool Stop_On_Error) { 88 | *this = O; 89 | this->Stop_On_Error = Stop_On_Error; 90 | } 91 | 92 | void Report(bool last = true); 93 | MSG_Type Type = NORMAL; 94 | private: 95 | Position Pos; 96 | string Msg = ""; 97 | string Cause = ""; 98 | bool Stop_On_Error = true; 99 | }; 100 | 101 | class Lexer_Expectation_Set; 102 | class Components; 103 | class Back_Expectation_Set; 104 | class Base; 105 | 106 | extern const string Red; 107 | extern const string Green; 108 | extern const string Yellow; 109 | extern const string Blue; 110 | extern const string Magenta; 111 | extern const string Cyan; 112 | extern const string White; 113 | extern const string Reset; 114 | 115 | void Report(Observation o); 116 | void Report(vector o); 117 | void Report(long type, Lexer_Expectation_Set expectation, string source, vector result); 118 | void Report(long type, Back_Expectation_Set expectation, string source, vector result); 119 | 120 | class Safe { 121 | public: 122 | Safe(vector i) : Input(i) { PostProsessor_Factory(); } 123 | Safe(){} 124 | 125 | 126 | vector Input; 127 | static inline vector Components; 128 | 129 | 130 | //single uses 131 | static void Check_For_Undefined_Inheritance(Node* n); 132 | 133 | static void Parser_Factory(); 134 | 135 | static void Go_Through_AST(void(*Modifier)(Node*& n)); 136 | static void Check_Return_Validity(Node* n); 137 | static void Disable_Non_Ptr_Class_Return(Node* n); 138 | static void Check_For_Unitialized_Objects(Node* func); 139 | static void Warn_Usage_Of_Depricated(Node* n); 140 | static void Prefer_Class_Cast_Rather_Object_Cast(Node* n); 141 | static void Warn_Usage_Before_Definition(Node* n); 142 | 143 | //Variable Un-Declarative Error givers. 144 | static void AST_Factory(Node*& n); 145 | static void Check_Usage_Of_Un_Declared_Variable(Node*& n); 146 | static void Flush_Errors(); 147 | 148 | //Cast missing error givers. 149 | static void Report_Missing_Cast(Node*& n); 150 | 151 | static void Reference_Count_Type_Un_Availability(); 152 | 153 | 154 | void PostProsessor_Factory(); 155 | }; 156 | 157 | #endif -------------------------------------------------------------------------------- /H/UI/Satellite.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | 6 | enum class INSTALL{ 7 | DEFAULT, 8 | }; 9 | 10 | enum class INTRODUCE { 11 | LOCAL, 12 | HTTPS, 13 | CONSOLE, 14 | }; 15 | 16 | namespace OS { 17 | const string WIN = "win"; 18 | const string UNIX = "unix"; 19 | } 20 | 21 | namespace ARCHITECTURE { 22 | const string X86 = "x86"; 23 | const string ARM = "arm"; 24 | } 25 | 26 | class Medium { 27 | public: 28 | //The OS this product is supposed to be installed onto. 29 | string Platform = ""; 30 | 31 | //The system that can fetch the product. 32 | INTRODUCE Introducer = INTRODUCE::LOCAL; 33 | 34 | //string address the finded dependecy is stored up to for later usage. 35 | string* Dependency_Location = nullptr; 36 | 37 | //Describes the Name of the product in question. 38 | string Product_ID = ""; 39 | 40 | // Used for the Scraper which finds function and global variables from dll/obj/exe/etc... 41 | vector Symbols; 42 | }; 43 | 44 | class Satellite { 45 | public: 46 | //Default Depedencies installation 47 | Satellite() { 48 | this->Installation_Type = INSTALL::DEFAULT; 49 | Init_Wanted_Dependencies(); 50 | Factory(); 51 | } 52 | 53 | Satellite(INSTALL Installation_Type) { 54 | this->Installation_Type = Installation_Type; 55 | Init_Wanted_Dependencies(); 56 | Factory(); 57 | } 58 | 59 | void Scraper(); // Automatically fetches all dll/lib's which contain imported function bodies. 60 | 61 | private: 62 | vector Chache; 63 | 64 | INSTALL Installation_Type; 65 | 66 | vector Dependecies; 67 | 68 | void Init_Wanted_Dependencies(); 69 | void Factory(); // For going through all the needed executable files. 70 | 71 | void Process_Local_Dependencies(Medium m); 72 | void Process_Console_Dependencies(Medium m); 73 | 74 | void Save_To_Cache(Medium m); 75 | 76 | vector Read_Symbol_Source_Service(string file_name); // the SSSS Symbol Source Service System 2000 77 | void Write_Symbol_Source_Service_Cache(vector data, string file_name); 78 | string Ident(string src, int count); 79 | string Quote(string src); 80 | }; -------------------------------------------------------------------------------- /H/UI/Service.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "Usr.h" 7 | #include "../../H/Lexer/Position.h" 8 | #include "../../H/Lexer/Lexer.h" 9 | #include "../../H/Lexer/Component.h" 10 | #include "../../H/Nodes/Node.h" 11 | #include "../../H/UI/Safe.h" 12 | #include "Document_Request_Type.h" 13 | 14 | using namespace std; 15 | extern Usr* sys; 16 | extern double Sensitivity; 17 | extern Node* Global_Scope; 18 | //extern enum MSG_Type; 19 | 20 | class Cursor { 21 | public: 22 | vector Previus; 23 | Component* Current; 24 | vector Next; 25 | }; 26 | 27 | enum CompletionItemKind { 28 | Text, 29 | Method, 30 | Function, 31 | Constructor, 32 | Field, 33 | Variable, 34 | Class, 35 | Interface, 36 | Module, 37 | Property, 38 | Unit, 39 | Value, 40 | Enum, 41 | Keyword, 42 | Snippet, 43 | Color, 44 | Reference, 45 | File, 46 | Folder, 47 | EnumMember, 48 | Constant, 49 | Struct, 50 | Event, 51 | Operator, 52 | TypeParameter, 53 | }; 54 | 55 | class Proxy { 56 | public: 57 | vector Input; 58 | 59 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ 60 | //Packet variables 61 | Document_Request_Type Type = Document_Request_Type::NONE; 62 | string Word = ""; 63 | string Uri = ""; 64 | Position Location = Position(); 65 | //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ 66 | 67 | Proxy(string raw); 68 | void Factory(); 69 | 70 | void Parse_Num(int i); 71 | void Parse_String(int& i); 72 | void Parse_Position(int i); 73 | 74 | string Find_Location_Of_Uri(); 75 | void Clean(string& raw); 76 | }; 77 | 78 | class UDP_Server { 79 | public: 80 | int Port = 0; 81 | int Socket = 0; 82 | 83 | 84 | Proxy* Receive(); 85 | 86 | void Send(char* Data, int Length); 87 | 88 | void Send(string Data) { 89 | Send(Data.data(), Data.size()); 90 | } 91 | 92 | void Send(MSG_Type Wellfare, vector MSG); 93 | 94 | UDP_Server(); 95 | ~UDP_Server(); 96 | }; 97 | 98 | class Service 99 | { 100 | public: 101 | UDP_Server Code_Completion_Handle = UDP_Server(); 102 | string Working_Dir = ""; 103 | mutex Multifile_Lock; 104 | Node* Singlefile_AST;// = new Node(CLASS_NODE, new Position()); 105 | vector Output; 106 | 107 | vector Cache; 108 | 109 | Service() { 110 | Singlefile_AST = Global_Scope; 111 | 112 | //Recieve the working dir from the VSC 113 | Working_Dir = Code_Completion_Handle.Receive()->Uri; 114 | 115 | Factory(); 116 | } 117 | 118 | void Factory(); 119 | 120 | void Handle_Auto_Completion(Proxy* i); 121 | void Handle_Code_Generation(Proxy* i); 122 | 123 | void Determine_Completion_Type(Proxy* cursor); 124 | Node* Find_Cursor_From_AST(Cursor* c); 125 | 126 | void Parse_Code(Proxy* proxy); 127 | 128 | Cursor* Search(int Absolute, vector* Raw); 129 | Cursor* Search_Absolute(int Line, int Character, string Source, vector* Components); 130 | int Calculate_Absolute_Position(int Line, int Character, string Source); 131 | 132 | vector Linearise(vector& Tree); 133 | double Percentage_Compare(string X, string Y); 134 | }; -------------------------------------------------------------------------------- /H/UI/Usr.h: -------------------------------------------------------------------------------- 1 | #ifndef _USR_H_ 2 | #define _USR_H_ 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "Document_Request_Type.h" 11 | using namespace std; 12 | 13 | class System{ 14 | public: 15 | string Source_File; 16 | string Destination_File; 17 | string OS; // Destination environment OS 18 | string HOST_OS; // Compiling environment OS 19 | string Architecture = "x86"; 20 | vector Pre_Compiled_Sources; // All in source imported Pre-Compiled-Sources are Liquefied 21 | vector Pre_Compiled_Linkable_Sources; // All Mentions of Import functions whiteout their respective importing PCS files get thrown here, for normal linking. 22 | vector Inlined_External_Symbols; // This is for all the symbols which are brought from the PCS files from syntax: "use" keyword 23 | string Repo_Dir = ""; 24 | vector Source_Files; 25 | string Format = "exe"; 26 | string Bytes_Mode = "0"; 27 | string Disable = ""; 28 | bool Debug = false; 29 | string VT_API = ""; 30 | int Reference_Count_Size = -1; 31 | bool Is_Service = false; 32 | bool Use_Scraper = true; // Automatically fetches dll/lib and links them if they have the necessary function implementations. 33 | 34 | string Start_Function_Name = "main"; 35 | 36 | string Evie_Location = ""; 37 | string Assembler_Location = ""; 38 | string Linker_Location = ""; 39 | 40 | class Node* Starting_Address = nullptr; 41 | 42 | // Flags 43 | bool Allow_Inconsistencies = true; 44 | 45 | System() { 46 | #if _WIN32 47 | OS = "win"; 48 | #else 49 | OS = "unix"; 50 | #endif 51 | #if _WIN32 52 | HOST_OS = "win"; 53 | #else 54 | HOST_OS = "unix"; 55 | #endif 56 | } 57 | void Fill_Empty_Arguments(); 58 | }; 59 | 60 | class Usr 61 | { 62 | public: 63 | System Info; 64 | Document_Request_Type Service_Info = Document_Request_Type::NONE; 65 | Usr(const char** in, int count) 66 | { 67 | Input = in; 68 | Argument_Amount = count; 69 | 70 | /*for (int i = 0; i < Argument_Amount; i++) { 71 | transform((char*)Input[i], (char*)Input[i] + strlen((char*)Input[i]), (char*)Input[i], tolower); 72 | replace((char*)Input[i], (char*)Input[i] + strlen((char*)Input[i]), '-', '_'); 73 | }*/ 74 | 75 | Create_Argument_Stats(); 76 | Info.Fill_Empty_Arguments(); 77 | } 78 | 79 | ~Usr(){} 80 | 81 | private: 82 | const char** Input; 83 | int Argument_Amount; 84 | void Create_Argument_Stats(); 85 | void Find_Source_File(int &i); 86 | void Find_Destination_File(int &i); 87 | void Find_OS(int& i); 88 | void Find_HOST_OS(int& i); 89 | void Find_Architecture(int &i); 90 | void Find_Bits_Mode(int &i); 91 | void Find_Format(int &i); 92 | void Find_Lib(int& i); 93 | void Find_Repo_Dir(int& i); 94 | void Find_Debug_Type(int& i); 95 | void Find_VT_API(int& i); 96 | void Find_Reference_Count(int& i); 97 | void Find_Evie_Executable_Position(); 98 | void Find_Service(int& i); 99 | void Find_Start_Function_Name(int& i); 100 | void Find_Allow_Inconsistencies(int& i); 101 | void Find_Use_Scraper(int& i); 102 | 103 | void Single_Argument_Use(); 104 | }; 105 | 106 | 107 | #endif 108 | -------------------------------------------------------------------------------- /IO/Test.e.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gabidal/Evie_Old/f9d187c246f566201b41dfada582df3b18a108c3/IO/Test.e.dll -------------------------------------------------------------------------------- /IO/Test_big.e: -------------------------------------------------------------------------------- 1 | type char{ 2 | size = 1 3 | } 4 | 5 | type int{ 6 | size = 4 7 | } 8 | 9 | type long{ 10 | size = 8 11 | } 12 | 13 | type bool{ 14 | size = 1 15 | } 16 | 17 | bool Is(){ 18 | return true 19 | } 20 | 21 | char ptr Inner(long size){ 22 | return size->(char ptr) 23 | } 24 | 25 | # fix where -> T pre Outer(){} the 'pre' is wrong but still somehow used as a inheritance. 26 | T ptr Outer(long Size){ 27 | 28 | return Inner(Size * T.size)->(T ptr) 29 | 30 | } 31 | 32 | type inheritable{ 33 | int x 34 | int a 35 | int b 36 | 37 | int ptr Do(){ 38 | return this->(int ptr) + 4->(int ptr) 39 | } 40 | 41 | inheritable ptr inheritable(){ 42 | return (this + inheritable.size->address)->(inheritable ptr) 43 | } 44 | } 45 | 46 | type inherit{ 47 | inheritable y 48 | } 49 | 50 | export int main(){ 51 | int Num = 123 52 | long r = Num->long - 48 53 | int a = 1 54 | int ptr b = a 55 | if (b == 2){ 56 | inheritable maybe.inheritable() 57 | 58 | int ptr dont = maybe.Do() 59 | 60 | inherit inh 61 | r = inh.y.x->long 62 | 63 | int i = 0 64 | 65 | if (Is() == true){ 66 | i = 0 67 | } 68 | 69 | char ptr c = Outer(r) 70 | 71 | while (1 < 2){ 72 | a = a + b[i] 73 | return a 74 | } 75 | 76 | return -1 77 | } 78 | 79 | return 1 + a 80 | } 81 | 82 | export int Start_Test(){ 83 | return main() 84 | } -------------------------------------------------------------------------------- /IO/_asm.h: -------------------------------------------------------------------------------- 1 | #func Local = "((_Z\d+\w+\:)|(\w+\:)|(\w+\d+\:))|(;.*)" 2 | func local = "global\ +([A-Za-z0-9_@]+)" -------------------------------------------------------------------------------- /IO/boost.e: -------------------------------------------------------------------------------- 1 | #Boost variables: 2 | 3 | type _STRING_ 4 | type _IR_ 5 | type _TOKEN_ 6 | type _LIST_ 7 | type _INTEGER_ 8 | _INTEGER_ _FLAG_ 9 | _INTEGER_ _STACK_OFFSET_ 10 | _STRING_ _UID_ 11 | _STRING_ _COMMENT_ 12 | 13 | _LIST_ _INPUT_ 14 | _INTEGER_ _PREVIOUS_ 15 | _INTEGER_ _CURRENT_ 16 | _INTEGER_ _NEXT_ 17 | 18 | 19 | _IR_ _ID_ 20 | _LIST_ _PARAMETERS_ 21 | 22 | _TOKEN_ _FLAGS_ 23 | _TOKEN_ _NAME_ 24 | _TOKEN_ _TYPE_ 25 | _FLAG_ _REGISTER_ 26 | _FLAG_ _NUMBER_ 27 | _FLAG_ _EXTERNAL_ 28 | _FLAG_ _TYPE_ 29 | _FLAG_ _FUNCTION_ 30 | _FLAG_ _ARRAY_ 31 | _FLAG_ _CONDITION_ 32 | _FLAG_ _OPERATOR_ 33 | _FLAG_ _RETURNING_ 34 | _FLAG_ _CALL_ 35 | _FLAG_ _PARAMETER_ 36 | _FLAG_ _PARANTHESIS_ 37 | _FLAG_ _CONSTRUCTOR_ 38 | _FLAG_ _REGISTER_ 39 | 40 | _FLAG_ _TASK_FOR_NON_VOLATILING_ 41 | _FLAG_ _TASK_FOR_RETURNING_ 42 | _FLAG_ _TASK_FOR_STACK_BASE_ADDRESSING_ 43 | _FLAG_ _TASK_FOR_STACK_ADDRESSING_ 44 | _FLAG_ _TASK_FOR_DEST_OFFSETTING_ 45 | _FLAG_ _TASK_FOR_SOURCE_OFFSETTING_ 46 | _FLAG_ _TASK_FOR_REMAINDER_ 47 | _FLAG_ _TASK_FOR_GENERAL_PURPOSE_ 48 | _FLAG_ _TASK_FOR_FLOATING_MATH_ 49 | 50 | _FLAG_ _NEED_FOR_SPACE_ 51 | _FLAG_ _GENERATED_ 52 | 53 | _FLAG_ _POINTTING_ 54 | _FLAG_ _ARRAY_ 55 | _FLAG_ _GIVING_ADDRESS_ 56 | _FLAG_ _STRING_ 57 | _FLAG_ _PREPROSESSOR_ 58 | _FLAG_ _SKIP_ 59 | 60 | 61 | #this pattern moves the number straight into the memory address 62 | $pattern ( 63 | if (_CURRENT_:_ID_ == "ldr")( 64 | if (_NEXT_:_ID_ == "=")( 65 | if (_CURRENT_:(_PARAMETERS_:(0:_FLAGS_)) & _FLAG_:_REGISTER_)( 66 | if (_CURRENT_:(_PARAMETERS_:(1:_FLAGS_)) & _FLAG_:_NUMBER_)( 67 | if (_NEXT_:(_PARAMETERS_:(0:_FLAGS_)) !& _FLAG_:_REGISTER_)( 68 | if (_NEXT_:(_PARAMETERS_:(1:_FLAGS_)) & _FLAG_:_REGISTER_)( 69 | _CURRENT_:_FLAGS_ |= _FLAG_:_SKIP_, 70 | _NEXT_:(_PARAMETERS_:1) = _CURRENT_:(_PARAMETERS_:1) 71 | ) 72 | ) 73 | ) 74 | ) 75 | ) 76 | ) 77 | ) 78 | 79 | #This pattern checks if we can make "reg <- 0" into just "xor reg, reg". 80 | $pattern ( 81 | if (_CURRENT_:_ID_ == "ldr")( 82 | if (_CURRENT_:(_PARAMETERS_:(0:_FLAGS_)) & _FLAG_:_REGISTER_)( 83 | if (_CURRENT_:(_PARAMETERS_:(1:_NAME_)) == "0")( 84 | _CURRENT_:(_PARAMETERS_:1) = _CURRENT_:(_PARAMETERS_:0), 85 | _CURRENT_:_ID_ = "^" 86 | ) 87 | ) 88 | ) 89 | ) 90 | 91 | #this pattern deletes reduntant savind/loading issues. 92 | $pattern( 93 | if (_CURRENT_:_ID_ == "=")( 94 | if (_NEXT_:_ID_ == "ldr")( 95 | if (_CURRENT_:(_PARAMETERS_:(0:_NAME_)) == _NEXT_:(_PARAMETERS_:(1:_NAME_)))( 96 | if (_CURRENT_:(_PARAMETERS_:(1:_UID_)) == _NEXT_:(_PARAMETERS_:(0:_UID_)))( 97 | _CURRENT_:_FLAGS_ |= _FLAG_:_SKIP_, 98 | _NEXT_:_FLAGS_ |= _FLAG_:_SKIP_, 99 | ) 100 | ) 101 | ) 102 | ) 103 | ) 104 | 105 | #this pattern deletes moving same reg into same reg. 106 | $pattern( 107 | if (_CURRENT_:_ID_ == "ldr")( 108 | if (_CURRENT_:(_PARAMETERS_:(0:_UID_)) != "")( 109 | if (_CURRENT_:(_PARAMETERS_:(0:_UID_)) == _CURRENT_:(_PARAMETERS_:(1:_UID_)))( 110 | _CURRENT_:_FLAGS_ |= _FLAG_:_SKIP_ 111 | ) 112 | ) 113 | ) 114 | if (_CURRENT_:_ID_ == "=")( 115 | if (_CURRENT_:(_PARAMETERS_:(0:_UID_)) != "")( 116 | if (_CURRENT_:(_PARAMETERS_:(0:_UID_)) == _CURRENT_:(_PARAMETERS_:(1:_UID_)))( 117 | _CURRENT_:_FLAGS_ |= _FLAG_:_SKIP_ 118 | ) 119 | ) 120 | ) 121 | ) 122 | 123 | 124 | #this pattern deletes reduntant loading of mem into two different regs 125 | $pattern ( 126 | if (_PREVIOUS_:_ID_ == "ldr")( 127 | if (_CURRENT_:_ID_ == "ldr")( 128 | if (_PREVIOUS_:(_PARAMETERS_:(1:_NAME_)) == _CURRENT_:(_PARAMETERS_:(1:_NAME_)))( 129 | if (_NEXT_:_FLAGS_ & _FLAG_:_OPERATOR_)( 130 | if (_NEXT_:(_PARAMETERS_:(0:_UID_)) == _PREVIOUS_:(_PARAMETERS_:(0:_UID_)))( 131 | if (_NEXT_:(_PARAMETERS_:(1:_UID_)) == _CURRENT_:(_PARAMETERS_:(0:_UID_)))( 132 | _CURRENT_:_FLAGS_ |= _FLAG_:_SKIP_, 133 | _NEXT_:(_PARAMETERS_:1) = _PREVIOUS_:(_PARAMETERS_:0), 134 | _NEXT_:_COMMENT_ ="Boosted" 135 | ) 136 | ) 137 | ) 138 | ) 139 | ) 140 | ) 141 | ) 142 | 143 | #this pattern deletes reuse of same opcode 144 | #by chekking the previus to have the same code as next 145 | #but current doesnt change eny of them then skip the 146 | #example: 147 | #mov ecx, ebx 148 | #mov .... 149 | #mov ecx, ebx 150 | 151 | $pattern ( 152 | if (_PREVIOUS_:_ID_ == "ldr")( 153 | if (_PREVIOUS_:_ID_ == _NEXT_:_ID_)( 154 | if (_PREVIOUS_:(_PARAMETERS_:(0:_NAME_)) == _NEXT_:(_PARAMETERS_:(0:_NAME_)))( 155 | if (_PREVIOUS_:(_PARAMETERS_:(1:_NAME_)) == _NEXT_:(_PARAMETERS_:(1:_NAME_)))( 156 | if (_CURRENT_:(_PARAMETERS_:(0:_NAME_)) == _PREVIOUS_:(_PARAMETERS_:(0:_NAME_)))( 157 | if (_CURRENT_:(_PARAMETERS_:(0:_FLAGS_)) & _FLAG_:_POINTTING_)( 158 | _NEXT_:_FLAGS_ |= _FLAG_:_SKIP_ 159 | ) 160 | if (_CURRENT_:(_PARAMETERS_:(0:_FLAGS_)) & _FLAG_:_ARRAY_)( 161 | _NEXT_:_FLAGS_ |= _FLAG_:_SKIP_ 162 | ) 163 | ) 164 | if (_CURRENT_:(_PARAMETERS_:(0:_NAME_)) != _PREVIOUS_:(_PARAMETERS_:(0:_NAME_)))( 165 | _NEXT_:_FLAGS_ |= _FLAG_:_SKIP_ 166 | ) 167 | ) 168 | ) 169 | ) 170 | ) 171 | ) -------------------------------------------------------------------------------- /IO/general.h: -------------------------------------------------------------------------------- 1 | loyal std = "_(\w*@*)*" 2 | func Generic = "[a-zA-Z0-9]+" -------------------------------------------------------------------------------- /IO/gl.e: -------------------------------------------------------------------------------- 1 | $use "gstd.e" 2 | 3 | import func _glClear@4()() 4 | import loyal func _glClearColor@16()() 5 | import func _glVertex2f@8()() 6 | import func _glBegin@4()() 7 | import func _glEnd@0()() 8 | import func _glFlush@0()() 9 | import func _glColor3f@12()() 10 | import func _glfwInit()() 11 | import func _glfwTerminate()() 12 | import func _glfwCreateWindow()() 13 | import func _glfwWindowShouldClose()() 14 | import func _glfwPollEvents()() 15 | import func _glfwMakeContextCurrent()() 16 | import func _glfwSwapBuffers()() 17 | 18 | 19 | 20 | dword GL_Color_Buffer_Bit = 16384 21 | dword GL_QUADS = 7 22 | 23 | 24 | func glClear(dword Constant)( 25 | push Constant 26 | _glClear@4() 27 | return 0 28 | ) 29 | 30 | func glClearColor(dword r, dword g, dword b, dword a) 31 | ( 32 | _glClearColor@16(r, g, b, a) 33 | return 0 34 | ) 35 | 36 | func glVertex2f(dword x, dword y)( 37 | push y 38 | push x 39 | _glVertex2f@8() 40 | return 0 41 | ) 42 | 43 | func glBegin(dword Mode)( 44 | push Mode 45 | _glBegin@4() 46 | return 0 47 | ) 48 | 49 | func glEnd()( 50 | _glEnd@0() 51 | return 0 52 | ) 53 | 54 | func glFlush()( 55 | _glFlush@0() 56 | return 0 57 | ) 58 | 59 | func glColor3f(dword r, dword g, dword b)( 60 | push b 61 | push g 62 | push r 63 | _glColor3f@12() 64 | return 0 65 | ) -------------------------------------------------------------------------------- /IO/test.e: -------------------------------------------------------------------------------- 1 | type int { 2 | size = 4 3 | } 4 | 5 | type char{ 6 | size = 1 7 | } 8 | 9 | int a = 1 10 | 11 | export int Start_Test(){ 12 | jump main 13 | return 0 14 | } 15 | 16 | export int main(){ 17 | return a 18 | 19 | } 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 GabidalG 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Linkers/arm_ld.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gabidal/Evie_Old/f9d187c246f566201b41dfada582df3b18a108c3/Linkers/arm_ld.exe -------------------------------------------------------------------------------- /Linkers/x86_ld.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gabidal/Evie_Old/f9d187c246f566201b41dfada582df3b18a108c3/Linkers/x86_ld.exe -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | ifeq ($(OS), Windows_NT) 2 | Additional_Flags += -lkernel32 -lWs2_32 -lWldap32 -lcrypt32 -ladvapi32 -lmsvcrt -o Evie -L"Dependencies/Curl/" 3 | else 4 | Additional_Flags += -lm -lpthread -ldl -lstdc++ -o Evie 5 | endif 6 | 7 | Debuggarna: 8 | g++ --std=c++20 $(Additional_Flags) -g -pthread -fpermissive Cpp/*.cpp Cpp/BackEnd/*.cpp Cpp/Docker/*.cpp Cpp/Lexer/*.cpp Cpp/Nodes/*.cpp Cpp/Parser/*.cpp Cpp/PreProsessor/*.cpp Cpp/UI/*.cpp Tests/*.cpp Tests/Cpp/*.cpp -lcurl 9 | 10 | all: 11 | g++ --std=c++20 $(Additional_Flags) -pthread -fpermissive Cpp/*.cpp Cpp/BackEnd/*.cpp Cpp/Docker/*.cpp Cpp/Lexer/*.cpp Cpp/Nodes/*.cpp Cpp/Parser/*.cpp Cpp/PreProsessor/*.cpp Cpp/UI/*.cpp Tests/*.cpp Tests/Cpp/*.cpp -lcurl 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Evie- lang 2 | 3 |
4 |
5 | 6 | ### Catalog: 7 | - ### [Documentation](#documentation) 8 | - ### [Arguments](#arguments) 9 | - ### [Notices](#notices) 10 | 11 |
12 |
13 | 14 | # Documentation 15 | ### https://gabidal.github.io/Evie-Document/ 16 | 17 |
18 |
19 | 20 | # Arguments 21 | ### -in [relative path/source file] 22 | ### -out [relative path/output file name] 23 | ### -os [target operating system (win/unix)]\n"; 24 | ### -host [the host operating system (win/unix)] 25 | ### -arch [output assembly type (x86/arm)] 26 | ### -lib [relative path/lib name] 27 | ### -repo-dir [relative/absolute path for saving git repos] 28 | ### -f [ supported output file formats are: 29 | ###   exe(executable (works for unix as well)), 30 | ###   lib(static lib), 31 | ###   dll(dynamic library (support is not made yet!)) 32 | ### ] 33 | ### -mode [bit mode for assembly output (32/64)] 34 | ### -debug [ supported debug symbol types: dwarf2 ] 35 | ### -vt [virus total API-key] 36 | ### -reference-count-size [reference count size] 37 | ### -service [starts Evie as a service with a port returned in standard out ] 38 |

39 | 40 | ### Quick usage:\n"; 41 | ### ./Evie -in foo/bar/baz.e\ 42 | ### Remember to set up an environment path named: \'Repo-Dir\' 43 | ### The order of arguments dont matter. 44 | 45 |

46 | 47 | # Notices 48 | #### If you are in Linux, then you need to install curllib for Evie to work :D 49 | #### I recommend you to install "sudo apt install libcurl4-openssl-dev" 50 | #### Other depencies that i recomend you install to compile Evie src: 51 | #### Clang 52 | #### Make -------------------------------------------------------------------------------- /Tests/Cpp/Base.cpp: -------------------------------------------------------------------------------- 1 | #include "../H/Base.h" 2 | 3 | string Base::Transform(long f) { 4 | if (f == Flags::COMMENT_COMPONENT) { 5 | return "comment"; 6 | } 7 | else if (f == Flags::END_COMPONENT) { 8 | return "end component"; 9 | } 10 | else if (f == Flags::KEYWORD_COMPONENT) { 11 | return "keyword"; 12 | } 13 | else if (f == Flags::NUMBER_COMPONENT) { 14 | return "number"; 15 | } 16 | else if (f == Flags::OPERATOR_COMPONENT) { 17 | return "operator"; 18 | } 19 | else if (f == Flags::PAREHTHESIS_COMPONENT) { 20 | return "parenthesis"; 21 | } 22 | else if (f == Flags::STRING_COMPONENT) { 23 | return "string"; 24 | } 25 | else if (f == Flags::TEXT_COMPONENT) { 26 | return "text"; 27 | } 28 | else if (f == Flags::UNDEFINED_COMPONENT) { 29 | return "undefined"; 30 | } 31 | else { 32 | throw::runtime_error("INTERNAL ERROR!"); 33 | } 34 | } -------------------------------------------------------------------------------- /Tests/Cpp/Test_Back_End.cpp: -------------------------------------------------------------------------------- 1 | #include "../H/Test_Back_End.h" 2 | #include "../../H/UI/Usr.h" 3 | #include "../../H/Nodes/Node.h" 4 | #include "../../H/BackEnd/Selector.h" 5 | #include "../../H/UI/Safe.h" 6 | #include "../../H/Docker/Mangler.h" 7 | #include "../../H/Docker/Docker.h" 8 | 9 | 10 | #ifdef _WIN32 11 | 12 | typedef __int64(__stdcall* FARPROC)(); 13 | 14 | extern "C" FARPROC __stdcall GetProcAddress(void*, const char*); 15 | extern "C" void* __stdcall LoadLibraryA (const char*); 16 | extern "C" int __stdcall FreeLibrary (void*); 17 | extern "C" int __stdcall GetLastError (); 18 | 19 | template 20 | R Call(void* handle, const char* name, T... arguments) { 21 | auto f = (R(*)(T...))GetProcAddress(handle, name); 22 | 23 | return f(arguments...); 24 | } 25 | //int a = Call(Handle, "Start_Test", 1, 2, 1.1); 26 | int Back_End_Test::Run_Dll(string f) { 27 | auto Handle = LoadLibraryA(f.c_str()); 28 | if (Handle == nullptr){ 29 | throw::runtime_error("INTERNAL ERROR!"); 30 | } 31 | 32 | auto Func = (int(*)())GetProcAddress(Handle, "_Z10Start_Testv"); 33 | //auto Func = (int(*)())GetProcAddress(Handle, "main"); 34 | if (Func == nullptr) 35 | throw::runtime_error("INTERNAL ERROR!"); 36 | 37 | int Result = Func(); 38 | 39 | FreeLibrary(Handle); 40 | 41 | return Result; 42 | } 43 | 44 | #else 45 | #include 46 | int Back_End_Test::Run_Dll(string f) { 47 | 48 | } 49 | #endif 50 | 51 | bool Use_ARM = false; 52 | bool Generate_Debug; 53 | 54 | 55 | extern Usr* sys; 56 | extern Node* Global_Scope; 57 | extern Selector* selector; 58 | extern x86_64 X86_64; 59 | extern int _SYSTEM_BIT_SIZE_; 60 | 61 | extern string Output; 62 | extern int arg_count; 63 | extern vector>>>> MANGLER::IDS; 64 | extern vector> DOCKER::Working_Dir; 65 | extern int ID; 66 | extern string* FileName; 67 | 68 | extern int Build(int argc, const char* argv[]); 69 | 70 | vector Back_End_Test::Run(string File) 71 | { 72 | MANGLER::IDS.clear(); 73 | arg_count = 0; 74 | DOCKER::Working_Dir.clear(); 75 | DOCKER::Included_Files.clear(); 76 | DOCKER::Assembly_Source_File.clear(); 77 | Global_Scope = nullptr; 78 | sys = nullptr; 79 | selector = nullptr; 80 | ID = 2; 81 | FileName = new string("No File"); 82 | 83 | const char** argv; 84 | int argc; 85 | string Use_Debug; 86 | if (Generate_Debug) 87 | Use_Debug = "-d"; 88 | if (Use_ARM) { 89 | argv = new const char* [9 + (Use_Debug == "-d")] { (new string(Executable_Location))->c_str(), "-in", File.c_str(), "-f", "dll", "-arch", "-arm", "-reference-count-size", "0" , Use_Debug.c_str() }; 90 | argc = 9 + (Use_Debug == "-d"); 91 | Output = ""; 92 | } 93 | else { 94 | argv = new const char* [7 + (Use_Debug == "-d")] { (new string(Executable_Location))->c_str(), "-in", File.c_str(), "-f", "dll", "-reference-count-size", "0", Use_Debug.c_str() }; 95 | argc = 7 + (Use_Debug == "-d"); 96 | Output = ".intel_syntax noprefix\n"; 97 | } 98 | 99 | Build(argc, argv); 100 | 101 | return { new Numeric_Info{Run_Dll(File + ".dll")} }; 102 | } 103 | 104 | void Back_End_Test::Factory() 105 | { 106 | cout << Magenta << "x86_64 -Release tests:" << Reset << endl; 107 | Use_ARM = false; 108 | Generate_Debug = false; 109 | for (auto i : Tests) { 110 | Check_Assert(i.first, i.second); 111 | } 112 | cout << "\n"; 113 | cout << Magenta << "x86_64 -Debug tests:" << Reset << endl; 114 | Use_ARM = false; 115 | Generate_Debug = true; 116 | for (auto i : Tests) { 117 | Check_Assert(i.first, i.second); 118 | } 119 | cout << "\n"; 120 | 121 | cout << "\n"; 122 | /* 123 | cout << Magenta << "\nARMv8_64 tests:" << Reset << endl; 124 | Use_ARM = true; 125 | for (auto i : Tests) { 126 | Check_Assert(i.first, i.second); 127 | } 128 | */ 129 | } 130 | 131 | void Back_End_Test::Check_Assert(Back_Expectation_Set expectation, string s) 132 | { 133 | bool fail = false; 134 | vector C = Run(s); 135 | if (expectation.has(NO_ORDER)) 136 | for (auto i : C) { 137 | for (auto j : expectation.Expecations) { 138 | /*if (i.Components.size() > 0) { 139 | for (auto C_C : i.Components) { 140 | for (auto E_C : expectation.Childs) { 141 | if (Check_Assert(E_C, C_C, s)) 142 | goto Child_Ok; 143 | } 144 | //no child was as expected 145 | fail = true; 146 | Report(FAIL, Lexer_Expectation_Set(expectation.Childs, expectation.F | expectation.Childs.begin()->F), "\"" + expectation.Get_Name(C_C) + "\" from '" + s + "'", i.Components); 147 | Child_Ok:; 148 | } 149 | goto Inside_Ok; 150 | }*/ 151 | if (Check_Assert(expectation.F, i, j)) { 152 | goto Found; 153 | } 154 | } 155 | //the loop has ended but no expectation was found! 156 | fail = true; 157 | Report(FAIL, expectation, "\"" + expectation.Get_Name(i) + "\" from '" + s + "'", C); 158 | Found:; 159 | } 160 | Inside_Ok:; 161 | if (!fail) { 162 | Report(SUCCESS, expectation, "\"" + s + "\"", C); 163 | } 164 | } 165 | 166 | bool Back_End_Test::Check_Assert(Back_Expectation_Set expectation, Base* a, string s) 167 | { 168 | return false; 169 | } 170 | 171 | bool Back_End_Test::Check_Assert(long F, Base* a, Base* b) 172 | { 173 | if (is(F, NO_NAMES)) { 174 | if (a->F == b->F) 175 | return true; 176 | return false; 177 | } 178 | else if (a->Type == NUMERIC_INFO) { 179 | if (((Numeric_Info&)*a).Val == ((Numeric_Info&)*b).Val) 180 | return true; 181 | return false; 182 | } 183 | else if (a->Type == TEXT_INFO) { 184 | if (((Text_Info&)*a).Val == ((Text_Info&)*b).Val) 185 | return true; 186 | return false; 187 | } 188 | return false; 189 | } 190 | 191 | void Back_End_Test::Init() 192 | { 193 | //what we expect the function to return, file name 194 | Tests = { 195 | //{{1}, "Tests/IO/main"}, 196 | {{5}, "Tests/IO/Template.e"}, 197 | {{2}, "IO/Test.e"}, 198 | {{0}, "Tests/IO/NameSpace.e"}, 199 | {{1}, "Tests/IO/Comment.e"}, 200 | {{5}, "Tests/IO/Func.e"}, 201 | {{1}, "Tests/IO/Type.e"}, 202 | {{2}, "Tests/IO/Cast.e"}, 203 | {{100}, "Tests/IO/Conditions.e"}, 204 | {{1}, "Tests/IO/Array.e"}, 205 | {{-6}, "Tests/IO/Math.e"}, 206 | {{1}, "Tests/IO/Destructor.e"}, 207 | {{10}, "Tests/IO/Ptr.e"}, 208 | {{4}, "Tests/IO/Global.e"}, 209 | }; 210 | } 211 | -------------------------------------------------------------------------------- /Tests/Cpp/Test_Lexer.cpp: -------------------------------------------------------------------------------- 1 | #include "../H/Test_Lexer.h" 2 | #include "../../H/UI/Safe.h" 3 | 4 | vector Lexer_Test::Run(string Case) 5 | { 6 | return Lexer::GetComponents(Case); 7 | } 8 | 9 | void Lexer_Test::Factory() 10 | { 11 | for (auto i : Tests) { 12 | Check_Assert(i.first, i.second); 13 | } 14 | } 15 | 16 | void Lexer_Test::Check_Assert(Lexer_Expectation_Set expectation, string s) 17 | { 18 | bool fail = false; 19 | vector C = Run(s); 20 | if (expectation.has(NO_ORDER)) 21 | for (auto i : C) { 22 | for (auto j : expectation.Expecations) { 23 | if (i.Components.size() > 0) { 24 | for (auto C_C : i.Components) { 25 | for (auto E_C : expectation.Childs) { 26 | if (Check_Assert(E_C, C_C, s)) 27 | goto Child_Ok; 28 | } 29 | //no child was as expected 30 | fail = true; 31 | Report(FAIL, Lexer_Expectation_Set(expectation.Childs, expectation.F | expectation.Childs.begin()->F), "\"" + expectation.Get_Name(C_C) + "\" from '" + s + "'", i.Components); 32 | Child_Ok:; 33 | } 34 | goto Inside_Ok; 35 | } 36 | if (Check_Assert(expectation.F, i, j)) { 37 | goto Found; 38 | } 39 | } 40 | //the loop has ended but no expectation was found! 41 | fail = true; 42 | Report(FAIL, expectation, "\"" + expectation.Get_Name(i) + "\" from '" + s + "'", C); 43 | Found:; 44 | } 45 | Inside_Ok:; 46 | if (!fail) { 47 | Report(SUCCESS, expectation, "\"" + s + "\"", C); 48 | } 49 | 50 | } 51 | 52 | bool Lexer_Test::Check_Assert(Lexer_Expectation_Set expectation, Component C, string s) 53 | { 54 | bool fail = false; 55 | if (expectation.has(NO_ORDER)) { 56 | for (auto j : expectation.Expecations) { 57 | if (C.Components.size() > 0) { 58 | for (auto C_C : C.Components) { 59 | for (auto E_C : expectation.Childs) { 60 | if (Check_Assert(E_C, C_C, s)) 61 | goto Child_Ok; 62 | } 63 | //no child was as expected 64 | fail = true; 65 | Report(FAIL, expectation, "\"" + expectation.Get_Name(C_C) + "\" from '" + s + "'", C.Components); 66 | Child_Ok:; 67 | } 68 | if (!fail) 69 | goto Inside_Ok; 70 | } 71 | if (Check_Assert(expectation.F, C, j)) { 72 | goto Found; 73 | } 74 | } 75 | //the loop has ended but no expectation was found! 76 | fail = true; 77 | return false; //Report(FAIL, expectation, "\"" + expectation.Get_Name(i) + "\" from '" + s + "'", C); 78 | 79 | Found:; 80 | if (!fail) { 81 | Inside_Ok:; 82 | return true; // Report(SUCCESS, expectation, "\"" + s + "\"", C); 83 | } 84 | } 85 | } 86 | 87 | bool Lexer_Test::Check_Assert(long F, Component a, Component b) 88 | { 89 | if (is(F, NO_NAMES) && a.is(b.Flags)) 90 | //this Flag means the only thing we are interested is the flag type that the component has 91 | return true; 92 | else if (a.is(b.Flags) && a.Value == b.Value) 93 | //name comparison & flag comparison 94 | return true; 95 | else 96 | return false; 97 | } 98 | 99 | void Lexer_Test::Init() 100 | { 101 | Lexer::DecimalSeparator = '.'; 102 | Lexer::ExponentSeparator = 'e'; 103 | Lexer::SingleLineCommentIdentifier = '#'; 104 | Lexer::StringIdentifier = '\"'; 105 | Lexer::Keywords = { 106 | "type", "func", "export", "import", "use", "if", "while", "else", "ptr", "ref", "jump", 107 | /*"size", size and deciaml and integer and format is no more a keyword because it can be also a variable name, only special in a class scoope*/ 108 | "return", "state", "internal", 109 | "cpp", "evie", "vivid", "plain", "static", "break", "continue" 110 | }; 111 | Tests = { 112 | 113 | { {vector{Flags::KEYWORD_COMPONENT, Flags::NUMBER_COMPONENT}}, "return 0"}, 114 | { {vector{Flags::TEXT_COMPONENT, Flags::TEXT_COMPONENT}}, "int a"}, 115 | { {vector>{ {Flags::TEXT_COMPONENT, "a"}, {Flags::OPERATOR_COMPONENT, "+"}, {Flags::NUMBER_COMPONENT, "1"}}}, "a + 1"}, 116 | { {vector{Flags::NUMBER_COMPONENT, Flags::OPERATOR_COMPONENT, Flags::TEXT_COMPONENT}}, "1.1 + a"}, 117 | { {vector{Flags::OPERATOR_COMPONENT, Flags::TEXT_COMPONENT, Flags::OPERATOR_COMPONENT, Flags::OPERATOR_COMPONENT, Flags::OPERATOR_COMPONENT, Flags::TEXT_COMPONENT, Flags::OPERATOR_COMPONENT}}, "++a-- + --a++"}, 118 | { {{vector{ new Text_Info({Flags::KEYWORD_COMPONENT, "while"}),new Lexer_Expectation_Set({Flags::TEXT_COMPONENT})}}}, "while (int)"}, 119 | { {{vector{ new Text_Info({Flags::TEXT_COMPONENT, "call"}),new Lexer_Expectation_Set({Flags::TEXT_COMPONENT})}}}, "call(a)"}, 120 | { {{vector{ new Text_Info({Flags::KEYWORD_COMPONENT, "import"}),new Text_Info({Flags::TEXT_COMPONENT, "function"}),new Lexer_Expectation_Set({Flags::TEXT_COMPONENT}),new Lexer_Expectation_Set({Flags::OPERATOR_COMPONENT}),new Lexer_Expectation_Set({Flags::NUMBER_COMPONENT})}}}, "import function(int, 0)"}, 121 | 122 | }; 123 | } 124 | -------------------------------------------------------------------------------- /Tests/H/Base.h: -------------------------------------------------------------------------------- 1 | #ifndef _BASE_H_ 2 | #define _BASE_H_ 3 | 4 | #include 5 | #include 6 | #include "../../H/Lexer/Lexer.h" 7 | #include 8 | 9 | using namespace std; 10 | 11 | constexpr long NO_ORDER = 1 << 0; 12 | constexpr long NO_NAMES = 1 << 1; 13 | 14 | enum Types { 15 | TEXT_INFO, 16 | NUMERIC_INFO, 17 | EXPECTATION 18 | }; 19 | 20 | class Base { 21 | public: 22 | Types Type; 23 | long F = 0; 24 | Base(Types t, long f) : Type(t), F(f) {} 25 | string Transform(long f); 26 | }; 27 | 28 | class Text_Info : public Base { 29 | public: 30 | string Val; 31 | Text_Info(initializer_list> l) : Base(TEXT_INFO, l.begin()->first) { 32 | Val = l.begin()->second; 33 | } 34 | Text_Info(pair l) : Base(TEXT_INFO, l.first) { 35 | Val = l.second; 36 | } 37 | }; 38 | 39 | class Numeric_Info : public Base { 40 | public: 41 | long long Val; 42 | Numeric_Info(initializer_list> l) : Base(NUMERIC_INFO, l.begin()->first) { 43 | Val = l.begin()->second; 44 | } 45 | Numeric_Info(initializer_list l) : Base(NUMERIC_INFO, NO_ORDER) { 46 | Val = *l.begin(); 47 | } 48 | }; 49 | 50 | #endif -------------------------------------------------------------------------------- /Tests/H/Test_Back_End.h: -------------------------------------------------------------------------------- 1 | #ifndef _TEST_BACK_END_H_ 2 | #define _TEST_BACK_END_H_ 3 | 4 | 5 | #include "Base.h" 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | class Back_Expectation_Set : public Base { 12 | public: 13 | vector Expecations; 14 | vector Childs; 15 | bool has(long f) { return (F & f) == f; } 16 | Back_Expectation_Set(initializer_list> l) : Base(EXPECTATION, NO_ORDER) { 17 | for (auto& i : *l.begin()) { 18 | if (i->Type == EXPECTATION) 19 | Childs.push_back((Back_Expectation_Set&)*i); 20 | else if (i->Type == TEXT_INFO || i->Type == NUMERIC_INFO) 21 | Expecations.push_back(i); 22 | } 23 | } 24 | Back_Expectation_Set(initializer_list l) : Base(EXPECTATION, NO_ORDER) { 25 | Expecations.push_back(new Numeric_Info{ l }); 26 | } 27 | 28 | string Get_Name(Base* c) { 29 | if (has(NO_NAMES)) 30 | return Transform(c->F); 31 | else { 32 | if (c->Type == TEXT_INFO) 33 | return ((Text_Info*)c)->Val; 34 | else if (c->Type == NUMERIC_INFO) 35 | return to_string(((Numeric_Info*)c)->Val); 36 | } 37 | } 38 | string Get_Name(int i) { 39 | return Get_Name(Expecations[i]); 40 | } 41 | }; 42 | 43 | class Back_End_Test { 44 | private: 45 | string Executable_Location; 46 | 47 | vector> Tests; 48 | vector Run(string); 49 | void Factory(); 50 | void Check_Assert(Back_Expectation_Set expectation, string s); 51 | bool Check_Assert(Back_Expectation_Set expectation, Base* a, string s); 52 | bool Check_Assert(long F, Base* a, Base* b); 53 | int Run_Dll(string f); 54 | bool is(long f1, long f2) 55 | { 56 | return (f1 & f2) == f2; 57 | } 58 | public: 59 | void Init(); 60 | Back_End_Test(vector> t) : Tests(t) { Factory(); } 61 | Back_End_Test(string Executable_Location) : Executable_Location(Executable_Location) { Init(); Factory(); } 62 | }; 63 | 64 | #endif -------------------------------------------------------------------------------- /Tests/H/Test_Lexer.h: -------------------------------------------------------------------------------- 1 | #ifndef _TEST_LEXER_H_ 2 | #define _TEST_LEXER_H_ 3 | 4 | #include "../../H/Lexer/Lexer.h" 5 | #include "Base.h" 6 | 7 | #include 8 | #include 9 | using namespace std; 10 | 11 | class Lexer_Expectation_Set : public Base { 12 | public: 13 | vector Expecations; 14 | vector Childs; 15 | bool has(long f) { return (F & f) == f; } 16 | Lexer_Expectation_Set(long f, vector E) : Base(EXPECTATION, f), Expecations(E) {} 17 | Lexer_Expectation_Set(long f, vector E) : Base(EXPECTATION, f) { 18 | for (auto i : E) 19 | Expecations.push_back(Component("", i)); 20 | } 21 | Lexer_Expectation_Set(vector E) : Base(EXPECTATION, NO_NAMES) { 22 | for (auto i : E) 23 | Expecations.push_back(Component("", i)); 24 | } 25 | Lexer_Expectation_Set(initializer_list> l) : Base(EXPECTATION, l.begin()->first) { 26 | Expecations.push_back(l.begin()->second); 27 | } 28 | Lexer_Expectation_Set(initializer_list>> l) : Base(EXPECTATION, l.begin()->first) { 29 | Expecations = l.begin()->second; 30 | } 31 | Lexer_Expectation_Set(initializer_list l) : Base(EXPECTATION, NO_NAMES | NO_ORDER) { 32 | Expecations.push_back(Component("", *l.begin())); 33 | } 34 | Lexer_Expectation_Set(initializer_list> l) : Base(EXPECTATION, NO_NAMES | NO_ORDER) { 35 | for (auto i : *l.begin()) 36 | Expecations.push_back(Component("", i)); 37 | } 38 | Lexer_Expectation_Set(initializer_list>> l) : Base(EXPECTATION, NO_ORDER) { 39 | for (auto i : *l.begin()) 40 | Expecations.push_back(Component(i.second, i.first)); 41 | } 42 | Lexer_Expectation_Set(initializer_list> l) : Base(EXPECTATION, NO_ORDER) { 43 | for (auto& i : *l.begin()) { 44 | if (i->Type == EXPECTATION) 45 | Childs.push_back((Lexer_Expectation_Set&)*i); 46 | else if (i->Type == TEXT_INFO) 47 | Expecations.push_back(Component(((Text_Info&)*i).Val, ((Text_Info&)*i).F)); 48 | } 49 | 50 | } 51 | Lexer_Expectation_Set(vector l, long f) : Base(EXPECTATION, f) { 52 | for (auto i : l) { 53 | Expecations.insert(Expecations.end(), i.Expecations.begin(), i.Expecations.end()); 54 | } 55 | } 56 | string Get_Name(Component c) { 57 | if (has(NO_NAMES)) 58 | return Transform(c.Flags); 59 | else 60 | return c.Value; 61 | } 62 | string Get_Name(int i) { 63 | if (has(NO_NAMES)) 64 | return Transform(Expecations[i].Flags); 65 | else 66 | return Expecations[i].Value; 67 | } 68 | }; 69 | 70 | class Lexer_Test { 71 | private: 72 | vector> Tests; 73 | vector Run(string); 74 | void Factory(); 75 | void Check_Assert(Lexer_Expectation_Set expectation, string s); 76 | bool Check_Assert(Lexer_Expectation_Set expectation, Component a, string s); 77 | bool Check_Assert(long F, Component a, Component b); 78 | bool is(long f1, long f2) 79 | { 80 | return (f1 & f2) == f2; 81 | } 82 | public: 83 | void Init(); 84 | Lexer_Test(vector> t) : Tests(t) { Factory(); } 85 | Lexer_Test() { Init(); Factory(); } 86 | }; 87 | 88 | #endif -------------------------------------------------------------------------------- /Tests/IO/Array.e: -------------------------------------------------------------------------------- 1 | use "https://github.com/Gabidal/std/std.e" 2 | 3 | use std 4 | 5 | export int Start_Test(int a, int b){ 6 | int ptr a = Allocate(10)->(int ptr) 7 | int ptr ptr b = a 8 | b[0, 1] = 1 9 | int c = b[0, 1] 10 | return c 11 | } 12 | 13 | export int main(){ 14 | return 1 15 | } -------------------------------------------------------------------------------- /Tests/IO/Array.e.asm: -------------------------------------------------------------------------------- 1 | .intel_syntax noprefix 2 | .global _Z4mainv 3 | .global _Z10Start_Testv 4 | .section .text #.text 5 | _Z10Start_Testv: 6 | sub rsp, 16 #.STACK, 16 7 | mov ecx, 10 #Size_99, 10 8 | mov r8d, ecx #REG_Size_990, Size_99 9 | mov r9, rdx #REG_Size_990_REMAINDER31322, REMAINDER_30333 10 | mov eax, 4 #4_QUOTIENT23811, 4 11 | mul r8d #REG_Size_990 12 | mov r8d, eax #REG_Size_990, 4_QUOTIENT23811 13 | mov rdx, r9 #REMAINDER_30333, REG_Size_990_REMAINDER31322 14 | mov ecx, ecx #REG_Size_991, Size_99 15 | mov r8, rdx #REG_Size_991_REMAINDER4664, REMAINDER_15141 16 | mov eax, 4 #4_QUOTIENT17673, 4 17 | mul ecx #REG_Size_991 18 | mov ecx, eax #REG_Size_991, 4_QUOTIENT17673 19 | mov rdx, r8 #REMAINDER_15141, REG_Size_991_REMAINDER4664 20 | mov ecx, ecx #REG_REG_Size_991_Parameter28703, REG_Size_991 21 | call _V17internal_allocatex_rPh 22 | mov qword ptr [rsp + 8 ], rax #.STACK_8, RetREG_2 23 | jmp Return_Here_131 #Return_Here_131 24 | Return_Here_131: 25 | mov rcx, qword ptr [rsp + 8 ] #REG_Return_Value993, .STACK_8 26 | mov qword ptr [rsp + 0 ], rcx #.STACK_0, REG_Return_Value993 27 | lea rcx, qword ptr [rsp + 0 ] #a_REG4, .STACK_0 28 | mov rcx, rcx #b, a_REG4 29 | mov r8, qword ptr [rcx + 0 * 8 ] #b_REG5, * 30 | lea r8, qword ptr [r8 + 1 * 4 ] #b_REG5_REG6, * 31 | mov dword ptr [r8 ], 1 #b_REG5_REG6, 1 32 | mov rcx, qword ptr [rcx + 0 * 8 ] #b_REG7, * 33 | mov ecx, dword ptr [rcx + 1 * 4 ] #b_REG7_REG8, * 34 | mov ecx, ecx #c, b_REG7_REG8 35 | mov eax, ecx #Returning_REG9, c 36 | add rsp, 16 #.STACK, 16 37 | ret # 38 | add rsp, 16 #.STACK, 16 39 | ret # 40 | 41 | 42 | _Z4mainv: 43 | mov eax, 1 #Returning_REG0, 1 44 | ret # 45 | ret # 46 | 47 | 48 | .section .data #.data 49 | std_MAX_CONSOLE_BUFFER_LENGHT: 50 | .long 4096 #4096 51 | std_GENERIC_WRITE: 52 | .long 1073741824 #1073741824 53 | std_GENERIC_READ: 54 | .quad 2147483648 #2147483648 55 | std_FILE_SHARE_NONE: 56 | .long 0 #0 57 | std_FILE_SHARE_READ: 58 | .long 1 #1 59 | std_FILE_SHARE_WRITE: 60 | .long 2 #2 61 | std_FILE_SHARE_DELETE: 62 | .long 4 #4 63 | std_CREATE_NEW: 64 | .long 1 #1 65 | std_CREATE_ALWAYS: 66 | .long 2 #2 67 | std_OPEN_EXISTING: 68 | .long 3 #3 69 | std_OPEN_ALWAYS: 70 | .long 4 #4 71 | std_TRUNCATE_EXISTING: 72 | .long 4 #4 73 | std_FILE_ATTRIBUTE_NORMAL: 74 | .long 128 #128 75 | std_FILE_ATTRIBUTE_FOLDER: 76 | .long 16 #16 77 | std_MAXIMUM_PATH_LENGTH: 78 | .long 260 #260 79 | std_ERROR_INSUFFICIENT_BUFFER: 80 | .long 122 #122 81 | std_MINIMUM_PROCESS_FILENAME_LENGTH: 82 | .long 50 #50 83 | -------------------------------------------------------------------------------- /Tests/IO/Cast.e: -------------------------------------------------------------------------------- 1 | use "https://github.com/Gabidal/std/std.e" 2 | 3 | type Base{ 4 | int Type = 0 5 | } 6 | 7 | Base Mid{ 8 | Type = 1 9 | float feature = 2.123845 10 | } 11 | 12 | Mid Top{ 13 | Type = 2 14 | int feature = 2 15 | } 16 | 17 | func test_all_format_casts(){ 18 | int i = 1 19 | 20 | float a = i->float 21 | double b = i->double 22 | 23 | i = a->int 24 | i = b->int 25 | 26 | a = b->float 27 | b = a->double 28 | } 29 | 30 | export int Start_Test(){ 31 | test_all_format_casts() 32 | Mid m.Mid() 33 | return m.feature->int 34 | } 35 | 36 | export int main(){ 37 | #Start_Test() 38 | return 1 39 | } -------------------------------------------------------------------------------- /Tests/IO/Cast.e.asm: -------------------------------------------------------------------------------- 1 | .intel_syntax noprefix 2 | .global _Z4mainv 3 | .global _Z10Start_Testv 4 | .section .text #.text 5 | _Z10Start_Testv: 6 | sub rsp, 16 #.STACK, 16 7 | Return_Here_123: 8 | lea rcx, qword ptr [rsp + 0 ] #m_REG0, .STACK_0 9 | mov rcx, rcx #m_TMP_2242033719216, m_REG0 10 | add qword ptr [rcx + 0 ], 1 #m_TMP_2242033719216_0, 1 11 | mov rcx, rcx #this_95, m_TMP_2242033719216 12 | mov r8, rcx #this_95_TMP_2242033705776, this_95 13 | add qword ptr [r8 + 0 ], 1 #this_95_TMP_2242033705776_0, 1 14 | mov r8, r8 #this_94_95, this_95_TMP_2242033705776 15 | mov r8, rcx #this_94_95, this_95 16 | mov dword ptr [r8 + 8 ], 0 #this_94_95_8, 0 17 | jmp Return_Here_126 #Return_Here_126 18 | Return_Here_126: 19 | mov dword ptr [rcx + 8 ], 1 #this_95_8, 1 20 | mov r8d, 1074261268 #REG_1074271162, 1074261268 21 | mov dword ptr [rcx + 12 ], r8d #this_95_12, REG_1074271162 22 | jmp Return_Here_125 #Return_Here_125 23 | Return_Here_125: 24 | movss xmm0, dword ptr [rsp + 0 + 12 ] #m_12_REG1, +_12 25 | cvttss2si ecx, xmm0 #REG_feature2, m_12_REG1 26 | mov eax, ecx #Returning_REG3, REG_feature2 27 | add rsp, 16 #.STACK, 16 28 | ret # 29 | add rsp, 16 #.STACK, 16 30 | ret # 31 | 32 | 33 | _Z4mainv: 34 | mov eax, 1 #Returning_REG0, 1 35 | ret # 36 | ret # 37 | 38 | 39 | .section .data #.data 40 | std_MAX_CONSOLE_BUFFER_LENGHT: 41 | .long 4096 #4096 42 | std_GENERIC_WRITE: 43 | .long 1073741824 #1073741824 44 | std_GENERIC_READ: 45 | .quad 2147483648 #2147483648 46 | std_FILE_SHARE_NONE: 47 | .long 0 #0 48 | std_FILE_SHARE_READ: 49 | .long 1 #1 50 | std_FILE_SHARE_WRITE: 51 | .long 2 #2 52 | std_FILE_SHARE_DELETE: 53 | .long 4 #4 54 | std_CREATE_NEW: 55 | .long 1 #1 56 | std_CREATE_ALWAYS: 57 | .long 2 #2 58 | std_OPEN_EXISTING: 59 | .long 3 #3 60 | std_OPEN_ALWAYS: 61 | .long 4 #4 62 | std_TRUNCATE_EXISTING: 63 | .long 4 #4 64 | std_FILE_ATTRIBUTE_NORMAL: 65 | .long 128 #128 66 | std_FILE_ATTRIBUTE_FOLDER: 67 | .long 16 #16 68 | std_MAXIMUM_PATH_LENGTH: 69 | .long 260 #260 70 | std_ERROR_INSUFFICIENT_BUFFER: 71 | .long 122 #122 72 | std_MINIMUM_PROCESS_FILENAME_LENGTH: 73 | .long 50 #50 74 | -------------------------------------------------------------------------------- /Tests/IO/Comment.e: -------------------------------------------------------------------------------- 1 | use "https://github.com/Gabidal/Evie/STD/STD.e" 2 | 3 | #info 4 | #this function is .... 5 | #Depricated: function no longer returns float 6 | #usage: use this to determine size of this object 7 | int banana(){ 8 | return 1 9 | } 10 | 11 | use std 12 | 13 | export int Start_Test(){ 14 | List a.List() 15 | 16 | return banana() 17 | } 18 | 19 | export int main(){ 20 | return 1 21 | } -------------------------------------------------------------------------------- /Tests/IO/Conditions.e: -------------------------------------------------------------------------------- 1 | use "https://github.com/Gabidal/std/std.e" 2 | 3 | export int Start_Test(){ 4 | int i 5 | while (i = 0, i < 100, i++){ 6 | 7 | } 8 | if (i == 100){ 9 | i = 10 10 | } 11 | if (i == 100){ 12 | i = 100 13 | } 14 | else (i == 10){ 15 | i = 100 16 | } 17 | return i 18 | 19 | while (1 < 2){} 20 | return 0 21 | } 22 | 23 | export int main(){ 24 | Start_Test() 25 | return 1 26 | } -------------------------------------------------------------------------------- /Tests/IO/Conditions.e.asm: -------------------------------------------------------------------------------- 1 | .intel_syntax noprefix 2 | .global _Z4mainv 3 | .global _Z10Start_Testv 4 | .section .text #.text 5 | _Z10Start_Testv: 6 | mov ecx, 0 #i, 0 7 | cmp ecx, 100 #i, 100 8 | jge while_6_END #while_6_END 9 | while_6: 10 | add ecx, 1 #i, 1 11 | cmp ecx, 100 #i, 100 12 | jge while_6_END #while_6_END 13 | jmp while_6 #while_6 14 | while_6_END: 15 | if_7: 16 | cmp ecx, 100 #i, 100 17 | jne if_7_END #if_7_END 18 | mov ecx, 10 #i, 10 19 | if_7_END: 20 | if_8: 21 | cmp ecx, 100 #i, 100 22 | jne else_9 #else_9 23 | mov ecx, 100 #i, 100 24 | jmp else_9_END #else_9_END 25 | if_8_END: 26 | else_9: 27 | cmp ecx, 10 #i, 10 28 | jne else_9_END #else_9_END 29 | mov ecx, 100 #i, 100 30 | else_9_END: 31 | mov eax, ecx #Returning_REG0, i 32 | ret # 33 | mov ecx, 1 #REG_11, 1 34 | cmp ecx, 2 #REG_11, 2 35 | jge while_10_END #while_10_END 36 | while_10: 37 | mov ecx, 1 #REG_12, 1 38 | cmp ecx, 2 #REG_12, 2 39 | jge while_10_END #while_10_END 40 | jmp while_10 #while_10 41 | while_10_END: 42 | mov eax, 0 #Returning_REG3, 0 43 | ret # 44 | ret # 45 | 46 | 47 | _Z4mainv: 48 | mov ecx, 0 #i_98, 0 49 | cmp ecx, 100 #i_98, 100 50 | jge while_11_END #while_11_END 51 | while_11: 52 | add ecx, 1 #i_98, 1 53 | cmp ecx, 100 #i_98, 100 54 | jge while_11_END #while_11_END 55 | jmp while_11 #while_11 56 | while_11_END: 57 | if_12: 58 | cmp ecx, 100 #i_98, 100 59 | jne if_12_END #if_12_END 60 | mov ecx, 10 #i_98, 10 61 | if_12_END: 62 | if_13: 63 | cmp ecx, 100 #i_98, 100 64 | jne else_14 #else_14 65 | mov ecx, 100 #i_98, 100 66 | jmp else_14_END #else_14_END 67 | if_13_END: 68 | else_14: 69 | cmp ecx, 10 #i_98, 10 70 | jne else_14_END #else_14_END 71 | mov ecx, 100 #i_98, 100 72 | else_14_END: 73 | jmp Return_Here_130 #Return_Here_130 74 | mov ecx, 1 #REG_10, 1 75 | cmp ecx, 2 #REG_10, 2 76 | jge while_15_END #while_15_END 77 | while_15: 78 | mov ecx, 1 #REG_11, 1 79 | cmp ecx, 2 #REG_11, 2 80 | jge while_15_END #while_15_END 81 | jmp while_15 #while_15 82 | while_15_END: 83 | jmp Return_Here_130 #Return_Here_130 84 | Return_Here_130: 85 | mov eax, 1 #Returning_REG2, 1 86 | ret # 87 | ret # 88 | 89 | 90 | .section .data #.data 91 | std_MAX_CONSOLE_BUFFER_LENGHT: 92 | .long 4096 #4096 93 | std_GENERIC_WRITE: 94 | .long 1073741824 #1073741824 95 | std_GENERIC_READ: 96 | .quad 2147483648 #2147483648 97 | std_FILE_SHARE_NONE: 98 | .long 0 #0 99 | std_FILE_SHARE_READ: 100 | .long 1 #1 101 | std_FILE_SHARE_WRITE: 102 | .long 2 #2 103 | std_FILE_SHARE_DELETE: 104 | .long 4 #4 105 | std_CREATE_NEW: 106 | .long 1 #1 107 | std_CREATE_ALWAYS: 108 | .long 2 #2 109 | std_OPEN_EXISTING: 110 | .long 3 #3 111 | std_OPEN_ALWAYS: 112 | .long 4 #4 113 | std_TRUNCATE_EXISTING: 114 | .long 4 #4 115 | std_FILE_ATTRIBUTE_NORMAL: 116 | .long 128 #128 117 | std_FILE_ATTRIBUTE_FOLDER: 118 | .long 16 #16 119 | std_MAXIMUM_PATH_LENGTH: 120 | .long 260 #260 121 | std_ERROR_INSUFFICIENT_BUFFER: 122 | .long 122 #122 123 | std_MINIMUM_PROCESS_FILENAME_LENGTH: 124 | .long 50 #50 125 | -------------------------------------------------------------------------------- /Tests/IO/Destructor.e: -------------------------------------------------------------------------------- 1 | use "https://github.com/Gabidal/std/std.e" 2 | 3 | export int main(){ 4 | Start_Test() 5 | return 1 6 | } 7 | 8 | type foo{ 9 | int X = 1 10 | int Y = 2 11 | } 12 | 13 | export int Start_Test(){ 14 | foo F = foo(New()) 15 | foo ptr handle_1 = F 16 | 17 | int x = handle_1.X 18 | return x 19 | } -------------------------------------------------------------------------------- /Tests/IO/Func.e: -------------------------------------------------------------------------------- 1 | use "https://github.com/Gabidal/std/std.e" 2 | 3 | export int main(){ 4 | jump Start_Test 5 | return 1 6 | } 7 | 8 | int foo(int x,int y){ 9 | return 5 10 | } 11 | 12 | int foo(float x, float y){ 13 | return 1 14 | } 15 | 16 | int bar(int x, int y){ 17 | return 2 18 | } 19 | 20 | export int Start_Test(){ 21 | func ptr fuz = foo 22 | 23 | #if (bababui){ 24 | # fuz = foo 25 | #} 26 | #else (express){ 27 | # fuz = bar 28 | #} 29 | # 30 | #if (alibaba){ 31 | # return fuz(1, 1) 32 | #} 33 | #else (joonas){ 34 | # return fuz(1, 1) 35 | #} 36 | 37 | return fuz(1, 1) 38 | } -------------------------------------------------------------------------------- /Tests/IO/Func.e.asm: -------------------------------------------------------------------------------- 1 | .intel_syntax noprefix 2 | .global _Z10Start_Testv 3 | .global _Z4mainv 4 | .section .text #.text 5 | _Z4mainv: 6 | jmp _Z10Start_Testv #_Z10Start_Testv 7 | mov eax, 1 #Returning_REG0, 1 8 | ret # 9 | ret # 10 | 11 | 12 | _Z3fooii: 13 | mov eax, 5 #Returning_REG0, 5 14 | ret # 15 | ret # 16 | 17 | 18 | _Z3fooff: 19 | mov eax, 1 #Returning_REG0, 1 20 | ret # 21 | ret # 22 | 23 | 24 | _Z10Start_Testv: 25 | lea rcx, qword ptr [rip + _Z3fooii ] #_Z3fooii_REG0, .RIP__Z3fooii 26 | mov rcx, rcx #fuz, _Z3fooii_REG0 27 | mov ecx, 1 #y_82, 1 28 | mov ecx, 1 #x_82, 1 29 | mov ecx, 5 #Return_Value82, 5 30 | jmp Return_Here_106 #Return_Here_106 31 | Return_Here_106: 32 | mov eax, ecx #Returning_REG1, Return_Value82 33 | ret # 34 | ret # 35 | 36 | 37 | .section .data #.data 38 | std_MAX_CONSOLE_BUFFER_LENGHT: 39 | .long 4096 #4096 40 | std_GENERIC_WRITE: 41 | .long 1073741824 #1073741824 42 | std_GENERIC_READ: 43 | .quad 2147483648 #2147483648 44 | std_FILE_SHARE_NONE: 45 | .long 0 #0 46 | std_FILE_SHARE_READ: 47 | .long 1 #1 48 | std_FILE_SHARE_WRITE: 49 | .long 2 #2 50 | std_FILE_SHARE_DELETE: 51 | .long 4 #4 52 | std_CREATE_NEW: 53 | .long 1 #1 54 | std_CREATE_ALWAYS: 55 | .long 2 #2 56 | std_OPEN_EXISTING: 57 | .long 3 #3 58 | std_OPEN_ALWAYS: 59 | .long 4 #4 60 | std_TRUNCATE_EXISTING: 61 | .long 4 #4 62 | std_FILE_ATTRIBUTE_NORMAL: 63 | .long 128 #128 64 | std_FILE_ATTRIBUTE_FOLDER: 65 | .long 16 #16 66 | std_MAXIMUM_PATH_LENGTH: 67 | .long 260 #260 68 | std_ERROR_INSUFFICIENT_BUFFER: 69 | .long 122 #122 70 | std_MINIMUM_PROCESS_FILENAME_LENGTH: 71 | .long 50 #50 72 | -------------------------------------------------------------------------------- /Tests/IO/Global.e: -------------------------------------------------------------------------------- 1 | use "https://github.com/Gabidal/std/std.e" 2 | 3 | int a = 1 4 | int b = 3 5 | 6 | export int Start_Test(){ 7 | return a + b 8 | } 9 | 10 | export int main(){ 11 | Start_Test() 12 | return 1 13 | } -------------------------------------------------------------------------------- /Tests/IO/Global.e.asm: -------------------------------------------------------------------------------- 1 | .intel_syntax noprefix 2 | .global _Z4mainv 3 | .global _Z10Start_Testv 4 | .section .text #.text 5 | _Z10Start_Testv: 6 | mov ecx, dword ptr [rip + a ] #REG_a0, .RIP_a 7 | add ecx, dword ptr [rip + b ] #REG_a0, .RIP_b 8 | mov eax, ecx #Returning_REG1, REG_a0 9 | ret # 10 | ret # 11 | 12 | 13 | _Z4mainv: 14 | jmp Return_Here_145 #Return_Here_145 15 | Return_Here_145: 16 | mov eax, 1 #Returning_REG0, 1 17 | ret # 18 | ret # 19 | 20 | 21 | .section .data #.data 22 | a: 23 | .long 1 #1 24 | b: 25 | .long 3 #3 26 | std_MAX_CONSOLE_BUFFER_LENGHT: 27 | .long 4096 #4096 28 | std_GENERIC_WRITE: 29 | .long 1073741824 #1073741824 30 | std_GENERIC_READ: 31 | .quad 2147483648 #2147483648 32 | std_FILE_SHARE_NONE: 33 | .long 0 #0 34 | std_FILE_SHARE_READ: 35 | .long 1 #1 36 | std_FILE_SHARE_WRITE: 37 | .long 2 #2 38 | std_FILE_SHARE_DELETE: 39 | .long 4 #4 40 | std_CREATE_NEW: 41 | .long 1 #1 42 | std_CREATE_ALWAYS: 43 | .long 2 #2 44 | std_OPEN_EXISTING: 45 | .long 3 #3 46 | std_OPEN_ALWAYS: 47 | .long 4 #4 48 | std_TRUNCATE_EXISTING: 49 | .long 4 #4 50 | std_FILE_ATTRIBUTE_NORMAL: 51 | .long 128 #128 52 | std_FILE_ATTRIBUTE_FOLDER: 53 | .long 16 #16 54 | std_MAXIMUM_PATH_LENGTH: 55 | .long 260 #260 56 | std_ERROR_INSUFFICIENT_BUFFER: 57 | .long 122 #122 58 | std_MINIMUM_PROCESS_FILENAME_LENGTH: 59 | .long 50 #50 60 | GLOBAL_SCOPE_a: 61 | .long 0 #0 62 | GLOBAL_SCOPE_b: 63 | .long 0 #0 64 | -------------------------------------------------------------------------------- /Tests/IO/Math.e: -------------------------------------------------------------------------------- 1 | use "https://github.com/Gabidal/std/std.e" 2 | 3 | int sum(int a){ 4 | return 3 + a 5 | } 6 | 7 | export int Start_Test(){ 8 | int a = 1 + 2 9 | int b = sum(a) 10 | int c = b * a 11 | int d = c / b 12 | return d + a + b - c 13 | 14 | return Test_Fpu(1.2, 2.3)->int 15 | 16 | return -6 17 | } 18 | 19 | float Test_Fpu(float a, float b){ 20 | return 1.2 + b - a - 1.3 21 | } 22 | 23 | export int main(){ 24 | Start_Test() 25 | return 1 26 | } -------------------------------------------------------------------------------- /Tests/IO/Math.e.asm: -------------------------------------------------------------------------------- 1 | .intel_syntax noprefix 2 | .global _Z4mainv 3 | .global _Z10Start_Testv 4 | .section .text #.text 5 | _Z10Start_Testv: 6 | mov ecx, 6 #Return_Value100, 6 7 | jmp Return_Here_132 #Return_Here_132 8 | Return_Here_132: 9 | mov r8d, ecx #REG_Return_Value1000, Return_Value100 10 | mov r9, rdx #REG_Return_Value1000_REMAINDER28253, REMAINDER_6868 11 | mov eax, 3 #3_QUOTIENT7711, 3 12 | mul r8d #REG_Return_Value1000 13 | mov r8d, eax #REG_Return_Value1000, 3_QUOTIENT7711 14 | mov rdx, r9 #REMAINDER_6868, REG_Return_Value1000_REMAINDER28253 15 | mov r8d, r8d #c, REG_Return_Value1000 16 | mov r9d, r8d #REG_c1, c 17 | xor edx, edx #REG_c1_REMAINDER27644, REG_c1_REMAINDER27644 18 | mov eax, r9d #REG_c1_QUOTIENT25547, REG_c1 19 | div ecx #Return_Value100 20 | mov r9d, eax #REG_c1, REG_c1_QUOTIENT25547 21 | mov ecx, r9d #d, REG_c1 22 | add ecx, 3 #d, 3 23 | add ecx, 6 #d, 6 24 | sub ecx, r8d #d, c 25 | mov eax, ecx #Returning_REG2, d 26 | ret # 27 | mov ecx, 1065353216 #REG_1065385878, 1065353216 28 | movd xmm0, ecx #MEDIA_1065385973, REG_1065385878 29 | movss xmm0, xmm0 #Return_Value101, MEDIA_1065385973 30 | jmp Return_Here_133 #Return_Here_133 31 | Return_Here_133: 32 | cvttss2si ecx, xmm0 #REG_Return_Value1013, Return_Value101 33 | mov eax, ecx #Returning_REG4, REG_Return_Value1013 34 | ret # 35 | mov eax, -6 #Returning_REG5, -6 36 | ret # 37 | ret # 38 | 39 | 40 | _Z4mainv: 41 | mov ecx, 6 #Return_Value100_102, 6 42 | jmp Return_Here_135 #Return_Here_135 43 | Return_Here_135: 44 | mov r8d, ecx #REG_Return_Value100_1020, Return_Value100_102 45 | mov r9, rdx #REG_Return_Value100_1020_REMAINDER12859, REMAINDER_8723 46 | mov eax, 3 #3_QUOTIENT20037, 3 47 | mul r8d #REG_Return_Value100_1020 48 | mov r8d, eax #REG_Return_Value100_1020, 3_QUOTIENT20037 49 | mov rdx, r9 #REMAINDER_8723, REG_Return_Value100_1020_REMAINDER12859 50 | mov r8d, r8d #c_102, REG_Return_Value100_1020 51 | mov r8d, r8d #REG_c_1021, c_102 52 | xor edx, edx #REG_c_1021_REMAINDER27529, REG_c_1021_REMAINDER27529 53 | mov eax, r8d #REG_c_1021_QUOTIENT9741, REG_c_1021 54 | div ecx #Return_Value100_102 55 | mov r8d, eax #REG_c_1021, REG_c_1021_QUOTIENT9741 56 | mov ecx, r8d #d_102, REG_c_1021 57 | jmp Return_Here_134 #Return_Here_134 58 | mov ecx, 1065353216 #REG_1065353994, 1065353216 59 | movd xmm0, ecx #MEDIA_1065365532, REG_1065353994 60 | movss xmm0, xmm0 #Return_Value101_102, MEDIA_1065365532 61 | jmp Return_Here_136 #Return_Here_136 62 | Return_Here_136: 63 | jmp Return_Here_134 #Return_Here_134 64 | jmp Return_Here_134 #Return_Here_134 65 | Return_Here_134: 66 | mov eax, 1 #Returning_REG2, 1 67 | ret # 68 | ret # 69 | 70 | 71 | .section .data #.data 72 | std_MAX_CONSOLE_BUFFER_LENGHT: 73 | .long 4096 #4096 74 | std_GENERIC_WRITE: 75 | .long 1073741824 #1073741824 76 | std_GENERIC_READ: 77 | .quad 2147483648 #2147483648 78 | std_FILE_SHARE_NONE: 79 | .long 0 #0 80 | std_FILE_SHARE_READ: 81 | .long 1 #1 82 | std_FILE_SHARE_WRITE: 83 | .long 2 #2 84 | std_FILE_SHARE_DELETE: 85 | .long 4 #4 86 | std_CREATE_NEW: 87 | .long 1 #1 88 | std_CREATE_ALWAYS: 89 | .long 2 #2 90 | std_OPEN_EXISTING: 91 | .long 3 #3 92 | std_OPEN_ALWAYS: 93 | .long 4 #4 94 | std_TRUNCATE_EXISTING: 95 | .long 4 #4 96 | std_FILE_ATTRIBUTE_NORMAL: 97 | .long 128 #128 98 | std_FILE_ATTRIBUTE_FOLDER: 99 | .long 16 #16 100 | std_MAXIMUM_PATH_LENGTH: 101 | .long 260 #260 102 | std_ERROR_INSUFFICIENT_BUFFER: 103 | .long 122 #122 104 | std_MINIMUM_PROCESS_FILENAME_LENGTH: 105 | .long 50 #50 106 | -------------------------------------------------------------------------------- /Tests/IO/NameSpace.e: -------------------------------------------------------------------------------- 1 | use "https://github.com/Gabidal/std/std.e" 2 | 3 | #cumulatie type or perhaps cum type? this joke was brought to you by lehtojo 25/3/2021/13:18. 4 | #Go and vote for the keyword to be used for using/inlining namespaces :D 5 | #https://docs.google.com/forms/d/e/1FAIpQLSfR5CAMP7dXWwrp_lcAa4PrpHgiuRlQxReuvX2oMiFtULR6vQ/viewform?usp=sf_link 6 | 7 | #a namespace is like a type class but everything inside it, is static type'd. 8 | type Banana{ #In the declaration of Banana we can set it to static 9 | #that way everything inside it will be static. 10 | 11 | #Or we can let Banana type be as it is, and set the static prefix to every child inside Banana. 12 | int X = 1 13 | static int Y = 2 14 | int Set(int x){ 15 | X = x 16 | return X + 1 17 | } 18 | } 19 | 20 | int Banana.Get(){ 21 | return Y + X 22 | } 23 | 24 | static Apple{ 25 | #Both of these member varibles are now static because the parent class is a static type. 26 | int X = 2 27 | int Y = 3 28 | } 29 | 30 | static Apple{ 31 | int Z = 3 32 | } 33 | 34 | export int Start_Test(){ 35 | use Apple 36 | Banana b.Banana() 37 | int B_X = b.Get() + b.Set(1) 38 | return Banana.Y + Y - B_X 39 | } 40 | 41 | export int main(){ 42 | #jump Start_Test 43 | return 1 44 | } -------------------------------------------------------------------------------- /Tests/IO/NameSpace.e.asm: -------------------------------------------------------------------------------- 1 | .intel_syntax noprefix 2 | .global _Z4mainv 3 | .global _Z10Start_Testv 4 | .section .text #.text 5 | _Z10Start_Testv: 6 | push rsi #rsi 7 | push rdi #rdi 8 | push rbx #rbx 9 | sub rsp, 16 #.STACK, 16 10 | lea rcx, qword ptr [rsp + 0 ] #b_REG0, .STACK_0 11 | mov rcx, rcx #b_TMP_2244092917568, b_REG0 12 | add qword ptr [rcx + 0 ], 1 #b_TMP_2244092917568_0, 1 13 | mov rcx, rcx #this_43, b_TMP_2244092917568 14 | mov dword ptr [rcx + 8 ], 1 #this_43_8, 1 15 | mov dword ptr [rip + Banana_Y ], 2 #.RIP_Banana_Y, 2 16 | jmp Return_Here_57 #Return_Here_57 17 | Return_Here_57: 18 | lea rcx, qword ptr [rsp + 0 ] #b_REG1, .STACK_0 19 | mov rcx, rcx #b_TMP_2244092925632, b_REG1 20 | add qword ptr [rcx + 0 ], 1 #b_TMP_2244092925632_0, 1 21 | mov rcx, rcx #this_41, b_TMP_2244092925632 22 | mov ebx, dword ptr [rip + Banana_Y ] #Banana_Y_REGISTER, .RIP_Banana_Y 23 | mov r8d, dword ptr [rcx + 8 ] #this_41_8_REG2, this_41_8 24 | add ebx, r8d #Banana_Y_REGISTER, this_41_8_REG2 25 | mov r8d, ebx #Return_Value41, Banana_Y_REGISTER 26 | jmp Return_Here_55 #Return_Here_55 27 | Return_Here_55: 28 | lea r9, qword ptr [rsp + 0 ] #b_REG3, .STACK_0 29 | mov r9, r9 #b_TMP_2244092956096, b_REG3 30 | add qword ptr [r9 + 0 ], 1 #b_TMP_2244092956096_0, 1 31 | mov rdi, r9 #this_42, b_TMP_2244092956096 32 | mov dword ptr [rdi + 8 ], 1 #this_42_8, 1 33 | mov r9d, dword ptr [rdi + 8 ] #this_42_8_REG4, this_42_8 34 | add r9d, 1 #this_42_8_REG4, 1 35 | mov r9d, r9d #Return_Value42, this_42_8_REG4 36 | jmp Return_Here_56 #Return_Here_56 37 | Return_Here_56: 38 | mov r8d, r8d #REG_Return_Value415, Return_Value41 39 | add r8d, r9d #REG_Return_Value415, Return_Value42 40 | mov esi, r8d #B_X, REG_Return_Value415 41 | mov rcx, rcx #REG_this_41_Parameter18716, this_41 42 | call _ZN6Banana10DestructorEP6Banana 43 | mov rcx, rdi #REG_this_42_Parameter19718, this_42 44 | call _ZN6Banana10DestructorEP6Banana 45 | mov ebx, dword ptr [rip + Banana_Y ] #Banana_Y_REGISTER, .RIP_Banana_Y 46 | mov ecx, dword ptr [rip + Apple_Y ] #Apple_Y_REGISTER, .RIP_Apple_Y 47 | add ebx, ecx #Banana_Y_REGISTER, Apple_Y_REGISTER 48 | sub ebx, esi #Banana_Y_REGISTER, B_X 49 | mov eax, ebx #Returning_REG8, Banana_Y_REGISTER 50 | add rsp, 16 #.STACK, 16 51 | pop rbx #rbx 52 | pop rdi #rdi 53 | pop rsi #rsi 54 | ret # 55 | add rsp, 16 #.STACK, 16 56 | pop rbx #rbx 57 | pop rdi #rdi 58 | pop rsi #rsi 59 | ret # 60 | 61 | 62 | _Z4mainv: 63 | mov eax, 1 #Returning_REG0, 1 64 | ret # 65 | ret # 66 | 67 | 68 | _ZN6Banana10DestructorEP6Banana: 69 | push rbx #rbx 70 | if_5: 71 | cmp rcx, 0 #this, 0 72 | je if_5_END #if_5_END 73 | mov r8, qword ptr [rcx + 0 ] #this_0_REG0, this_0 74 | sub r8, 1 #this_0_REG0, 1 75 | cmp r8, 1 #this_0_REG0, 1 76 | jge if_5_END #if_5_END 77 | mov r8, rcx #this_TMP_2244092974912, this 78 | add qword ptr [r8 + 0 ], 1 #this_TMP_2244092974912_0, 1 79 | mov rbx, r8 #Address_40, this_TMP_2244092974912 80 | mov rbx, rcx #Address_40, this 81 | mov rcx, rbx #REG_Address_40_Parameter19895, Address_40 82 | mov edx, 8 #REG_8_Parameter5447, 8 83 | call _V19internal_deallocatePhx 84 | Return_Here_54: 85 | mov rcx, rbx #REG_Address_40_Parameter21726, Address_40 86 | call _ZN6Banana10DestructorEP6Banana 87 | if_5_END: 88 | pop rbx #rbx 89 | ret # 90 | 91 | 92 | .section .data #.data 93 | std_MAX_CONSOLE_BUFFER_LENGHT: 94 | .long 4096 #4096 95 | std_GENERIC_WRITE: 96 | .long 1073741824 #1073741824 97 | std_GENERIC_READ: 98 | .quad 2147483648 #2147483648 99 | std_FILE_SHARE_NONE: 100 | .long 0 #0 101 | std_FILE_SHARE_READ: 102 | .long 1 #1 103 | std_FILE_SHARE_WRITE: 104 | .long 2 #2 105 | std_FILE_SHARE_DELETE: 106 | .long 4 #4 107 | std_CREATE_NEW: 108 | .long 1 #1 109 | std_CREATE_ALWAYS: 110 | .long 2 #2 111 | std_OPEN_EXISTING: 112 | .long 3 #3 113 | std_OPEN_ALWAYS: 114 | .long 4 #4 115 | std_TRUNCATE_EXISTING: 116 | .long 4 #4 117 | std_FILE_ATTRIBUTE_NORMAL: 118 | .long 128 #128 119 | std_FILE_ATTRIBUTE_FOLDER: 120 | .long 16 #16 121 | std_MAXIMUM_PATH_LENGTH: 122 | .long 260 #260 123 | std_ERROR_INSUFFICIENT_BUFFER: 124 | .long 122 #122 125 | std_MINIMUM_PROCESS_FILENAME_LENGTH: 126 | .long 50 #50 127 | Banana_Y: 128 | .long 2 #2 129 | Apple_X: 130 | .long 2 #2 131 | Apple_Y: 132 | .long 3 #3 133 | Apple_Z: 134 | .long 3 #3 135 | -------------------------------------------------------------------------------- /Tests/IO/Operator_Overload.e: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gabidal/Evie_Old/f9d187c246f566201b41dfada582df3b18a108c3/Tests/IO/Operator_Overload.e -------------------------------------------------------------------------------- /Tests/IO/Ptr.e: -------------------------------------------------------------------------------- 1 | use "https://github.com/Gabidal/std/std.e" 2 | 3 | type cpp ptr Static_Cast {} 4 | 5 | export int Start_Test(){ 6 | int val = 10 7 | int ptr a = val 8 | int ptr ptr b = a 9 | return a 10 | 11 | int ptr ptr ptr c = b 12 | int ptr ptr ptr ptr d = c 13 | int ptr ptr ptr ptr ptr e = d 14 | int ptr ptr ptr ptr ptr ptr f = e 15 | return f 16 | 17 | int ptr Normal_Cast_needing_Var = 123->Static_Cast 18 | return Normal_Cast_needing_Var 19 | 20 | int ptr ptr Dynamic_needing_Var = 1234->address 21 | return Dynamic_needing_Var 22 | } 23 | 24 | export int main(){ 25 | Start_Test() 26 | return 1 27 | } 28 | -------------------------------------------------------------------------------- /Tests/IO/Ptr.e.asm: -------------------------------------------------------------------------------- 1 | .intel_syntax noprefix 2 | .global _Z4mainv 3 | .global _Z10Start_Testv 4 | .section .text #.text 5 | _Z10Start_Testv: 6 | sub rsp, 44 #.STACK, 44 7 | mov dword ptr [rsp + 0 ], 10 #.STACK_0, 10 8 | lea rcx, qword ptr [rsp + 0 ] #val_REG0, .STACK_0 9 | mov qword ptr [rsp + 4 ], rcx #.STACK_4, val_REG0 10 | lea rcx, qword ptr [rsp + 4 ] #a_REG1, .STACK_4 11 | mov qword ptr [rsp + 12 ], rcx #.STACK_12, a_REG1 12 | mov rcx, qword ptr [rsp + 4 ] #a_REG2, .STACK_4 13 | mov ecx, dword ptr [rcx ] #a_REG2_REG3, a_REG2 14 | mov eax, ecx #Returning_REG4, a_REG2_REG3 15 | add rsp, 44 #.STACK, 44 16 | ret # 17 | lea rcx, qword ptr [rsp + 12 ] #b_REG5, .STACK_12 18 | mov qword ptr [rsp + 20 ], rcx #.STACK_20, b_REG5 19 | lea rcx, qword ptr [rsp + 20 ] #c_REG6, .STACK_20 20 | mov qword ptr [rsp + 28 ], rcx #.STACK_28, c_REG6 21 | lea rcx, qword ptr [rsp + 28 ] #d_REG7, .STACK_28 22 | mov qword ptr [rsp + 36 ], rcx #.STACK_36, d_REG7 23 | lea rcx, qword ptr [rsp + 36 ] #e_REG8, .STACK_36 24 | mov rcx, rcx #f, e_REG8 25 | mov rcx, qword ptr [rcx ] #f_REG9, f 26 | mov rcx, qword ptr [rcx ] #f_REG9_REG10, f_REG9 27 | mov rcx, qword ptr [rcx ] #f_REG9_REG10_REG11, f_REG9_REG10 28 | mov rcx, qword ptr [rcx ] #f_REG9_REG10_REG11_REG12, f_REG9_REG10_REG11 29 | mov rcx, qword ptr [rcx ] #f_REG9_REG10_REG11_REG12_REG13, f_REG9_REG10_REG11_REG12 30 | mov ecx, dword ptr [rcx ] #f_REG9_REG10_REG11_REG12_REG13_REG14, f_REG9_REG10_REG11_REG12_REG13 31 | mov eax, ecx #Returning_REG15, f_REG9_REG10_REG11_REG12_REG13_REG14 32 | add rsp, 44 #.STACK, 44 33 | ret # 34 | mov rcx, 123 #Normal_Cast_needing_Var, 123 35 | mov ecx, dword ptr [rcx ] #Normal_Cast_needing_Var_REG16, Normal_Cast_needing_Var 36 | mov eax, ecx #Returning_REG17, Normal_Cast_needing_Var_REG16 37 | add rsp, 44 #.STACK, 44 38 | ret # 39 | mov rcx, 1234 #Dynamic_needing_Var, 1234 40 | mov rcx, qword ptr [rcx ] #Dynamic_needing_Var_REG18, Dynamic_needing_Var 41 | mov ecx, dword ptr [rcx ] #Dynamic_needing_Var_REG18_REG19, Dynamic_needing_Var_REG18 42 | mov eax, ecx #Returning_REG20, Dynamic_needing_Var_REG18_REG19 43 | add rsp, 44 #.STACK, 44 44 | ret # 45 | add rsp, 44 #.STACK, 44 46 | ret # 47 | 48 | 49 | _Z4mainv: 50 | sub rsp, 44 #.STACK, 44 51 | mov dword ptr [rsp + 0 ], 10 #.STACK_0, 10 52 | lea rcx, qword ptr [rsp + 0 ] #val_108_REG0, .STACK_0 53 | mov qword ptr [rsp + 4 ], rcx #.STACK_4, val_108_REG0 54 | lea rcx, qword ptr [rsp + 4 ] #a_108_REG1, .STACK_4 55 | mov qword ptr [rsp + 12 ], rcx #.STACK_12, a_108_REG1 56 | jmp Return_Here_144 #Return_Here_144 57 | lea rcx, qword ptr [rsp + 12 ] #b_108_REG2, .STACK_12 58 | mov qword ptr [rsp + 20 ], rcx #.STACK_20, b_108_REG2 59 | lea rcx, qword ptr [rsp + 20 ] #c_108_REG3, .STACK_20 60 | mov qword ptr [rsp + 28 ], rcx #.STACK_28, c_108_REG3 61 | lea rcx, qword ptr [rsp + 28 ] #d_108_REG4, .STACK_28 62 | mov qword ptr [rsp + 36 ], rcx #.STACK_36, d_108_REG4 63 | lea rcx, qword ptr [rsp + 36 ] #e_108_REG5, .STACK_36 64 | mov rcx, rcx #f_108, e_108_REG5 65 | jmp Return_Here_144 #Return_Here_144 66 | mov rcx, 123 #Normal_Cast_needing_Var_108, 123 67 | jmp Return_Here_144 #Return_Here_144 68 | mov rcx, 1234 #Dynamic_needing_Var_108, 1234 69 | jmp Return_Here_144 #Return_Here_144 70 | Return_Here_144: 71 | mov eax, 1 #Returning_REG6, 1 72 | add rsp, 44 #.STACK, 44 73 | ret # 74 | add rsp, 44 #.STACK, 44 75 | ret # 76 | 77 | 78 | .section .data #.data 79 | std_MAX_CONSOLE_BUFFER_LENGHT: 80 | .long 4096 #4096 81 | std_GENERIC_WRITE: 82 | .long 1073741824 #1073741824 83 | std_GENERIC_READ: 84 | .quad 2147483648 #2147483648 85 | std_FILE_SHARE_NONE: 86 | .long 0 #0 87 | std_FILE_SHARE_READ: 88 | .long 1 #1 89 | std_FILE_SHARE_WRITE: 90 | .long 2 #2 91 | std_FILE_SHARE_DELETE: 92 | .long 4 #4 93 | std_CREATE_NEW: 94 | .long 1 #1 95 | std_CREATE_ALWAYS: 96 | .long 2 #2 97 | std_OPEN_EXISTING: 98 | .long 3 #3 99 | std_OPEN_ALWAYS: 100 | .long 4 #4 101 | std_TRUNCATE_EXISTING: 102 | .long 4 #4 103 | std_FILE_ATTRIBUTE_NORMAL: 104 | .long 128 #128 105 | std_FILE_ATTRIBUTE_FOLDER: 106 | .long 16 #16 107 | std_MAXIMUM_PATH_LENGTH: 108 | .long 260 #260 109 | std_ERROR_INSUFFICIENT_BUFFER: 110 | .long 122 #122 111 | std_MINIMUM_PROCESS_FILENAME_LENGTH: 112 | .long 50 #50 113 | -------------------------------------------------------------------------------- /Tests/IO/Template.e: -------------------------------------------------------------------------------- 1 | #use "https://github.com/Gabidal/std/std.e" 2 | use "C:\Users\Quanf\source\repos\std\std.e" 3 | 4 | use std 5 | 6 | export int Start_Test(){ 7 | List a.List() 8 | a.Add(5) 9 | a.Add(2) 10 | a.Pop_Back() 11 | return a.At(0) 12 | } 13 | 14 | export int main(){ 15 | jump Start_Test 16 | return 1 17 | } -------------------------------------------------------------------------------- /Tests/IO/Type.e: -------------------------------------------------------------------------------- 1 | use "https://github.com/Gabidal/std/std.e" 2 | 3 | type Fruit{ 4 | int Type = 3 5 | } 6 | 7 | Fruit ptr Fruit(Fruit ptr this){ 8 | this.Type = 4 9 | } 10 | 11 | Fruit Banana{ 12 | int Sugar = 1 13 | int Protein = 2 14 | int size = 6 15 | Type = 5 16 | } 17 | 18 | int Get_Sugar(Banana ptr b){ 19 | return b.Sugar 20 | } 21 | 22 | int is_Banana(Fruit ptr f){ 23 | return Get_Sugar(f) 24 | } 25 | 26 | export int Start_Test(){ 27 | Banana x.Banana() 28 | return is_Banana(x) 29 | } 30 | 31 | export int main(){ 32 | Start_Test() 33 | return 1 34 | } -------------------------------------------------------------------------------- /Tests/IO/Type.e.asm: -------------------------------------------------------------------------------- 1 | .intel_syntax noprefix 2 | .global _Z4mainv 3 | .global _Z10Start_Testv 4 | .section .text #.text 5 | _Z10Start_Testv: 6 | sub rsp, 24 #.STACK, 24 7 | lea rcx, qword ptr [rsp + 0 ] #x_REG0, .STACK_0 8 | mov rcx, rcx #x_TMP_2242019697712, x_REG0 9 | add qword ptr [rcx + 0 ], 1 #x_TMP_2242019697712_0, 1 10 | mov rcx, rcx #this_86, x_TMP_2242019697712 11 | mov r8, rcx #this_86_TMP_2242019702192, this_86 12 | add qword ptr [r8 + 0 ], 1 #this_86_TMP_2242019702192_0, 1 13 | mov r8, r8 #this_85_86, this_86_TMP_2242019702192 14 | mov r8, rcx #this_85_86, this_86 15 | mov dword ptr [r8 + 8 ], 4 #this_85_86_8, 4 16 | Return_Here_111: 17 | mov dword ptr [rcx + 12 ], 1 #this_86_12, 1 18 | mov dword ptr [rcx + 16 ], 2 #this_86_16, 2 19 | mov dword ptr [rcx + 20 ], 6 #this_86_20, 6 20 | mov dword ptr [rcx + 8 ], 5 #this_86_8, 5 21 | jmp Return_Here_110 #Return_Here_110 22 | Return_Here_110: 23 | lea rcx, qword ptr [rsp + 0 ] #x_REG1, .STACK_0 24 | mov rcx, rcx #x_TMP_2242020510256, x_REG1 25 | add qword ptr [rcx + 0 ], 1 #x_TMP_2242020510256_0, 1 26 | mov rcx, rcx #f_87, x_TMP_2242020510256 27 | mov r8, rcx #f_87_TMP_2242020494128, f_87 28 | add qword ptr [r8 + 0 ], 1 #f_87_TMP_2242020494128_0, 1 29 | mov r8, r8 #b_84_87, f_87_TMP_2242020494128 30 | mov r8, rcx #b_84_87, f_87 31 | jmp Return_Here_113 #Return_Here_113 32 | Return_Here_113: 33 | mov ecx, dword ptr [r8 + 12 ] #b_84_87_12_REG2, b_84_87_12 34 | mov ecx, ecx #Return_Value87, b_84_87_12_REG2 35 | jmp Return_Here_112 #Return_Here_112 36 | Return_Here_112: 37 | mov eax, ecx #Returning_REG3, Return_Value87 38 | add rsp, 24 #.STACK, 24 39 | ret # 40 | add rsp, 24 #.STACK, 24 41 | ret # 42 | 43 | 44 | _Z4mainv: 45 | sub rsp, 24 #.STACK, 24 46 | lea rcx, qword ptr [rsp + 0 ] #x_88_REG0, .STACK_0 47 | mov rcx, rcx #x_88_TMP_2242020530864, x_88_REG0 48 | add qword ptr [rcx + 0 ], 1 #x_88_TMP_2242020530864_0, 1 49 | mov rcx, rcx #this_86_88, x_88_TMP_2242020530864 50 | mov r8, rcx #this_86_88_TMP_2242020572080, this_86_88 51 | add qword ptr [r8 + 0 ], 1 #this_86_88_TMP_2242020572080_0, 1 52 | mov r8, r8 #this_85_86_88, this_86_88_TMP_2242020572080 53 | mov r8, rcx #this_85_86_88, this_86_88 54 | mov dword ptr [r8 + 8 ], 4 #this_85_86_88_8, 4 55 | Return_Here_115: 56 | mov dword ptr [rcx + 12 ], 1 #this_86_88_12, 1 57 | mov dword ptr [rcx + 16 ], 2 #this_86_88_16, 2 58 | mov dword ptr [rcx + 20 ], 6 #this_86_88_20, 6 59 | mov dword ptr [rcx + 8 ], 5 #this_86_88_8, 5 60 | jmp Return_Here_116 #Return_Here_116 61 | Return_Here_116: 62 | lea rcx, qword ptr [rsp + 0 ] #x_88_REG1, .STACK_0 63 | mov rcx, rcx #x_88_TMP_2242020548784, x_88_REG1 64 | add qword ptr [rcx + 0 ], 1 #x_88_TMP_2242020548784_0, 1 65 | mov rcx, rcx #f_87_88, x_88_TMP_2242020548784 66 | mov r8, rcx #f_87_88_TMP_2242020575664, f_87_88 67 | add qword ptr [r8 + 0 ], 1 #f_87_88_TMP_2242020575664_0, 1 68 | mov r8, r8 #b_84_87_88, f_87_88_TMP_2242020575664 69 | mov r8, rcx #b_84_87_88, f_87_88 70 | jmp Return_Here_117 #Return_Here_117 71 | Return_Here_117: 72 | mov ecx, dword ptr [r8 + 12 ] #b_84_87_88_12_REG2, b_84_87_88_12 73 | mov ecx, ecx #Return_Value87_88, b_84_87_88_12_REG2 74 | jmp Return_Here_118 #Return_Here_118 75 | Return_Here_118: 76 | jmp Return_Here_114 #Return_Here_114 77 | Return_Here_114: 78 | mov eax, 1 #Returning_REG3, 1 79 | add rsp, 24 #.STACK, 24 80 | ret # 81 | add rsp, 24 #.STACK, 24 82 | ret # 83 | 84 | 85 | .section .data #.data 86 | std_MAX_CONSOLE_BUFFER_LENGHT: 87 | .long 4096 #4096 88 | std_GENERIC_WRITE: 89 | .long 1073741824 #1073741824 90 | std_GENERIC_READ: 91 | .quad 2147483648 #2147483648 92 | std_FILE_SHARE_NONE: 93 | .long 0 #0 94 | std_FILE_SHARE_READ: 95 | .long 1 #1 96 | std_FILE_SHARE_WRITE: 97 | .long 2 #2 98 | std_FILE_SHARE_DELETE: 99 | .long 4 #4 100 | std_CREATE_NEW: 101 | .long 1 #1 102 | std_CREATE_ALWAYS: 103 | .long 2 #2 104 | std_OPEN_EXISTING: 105 | .long 3 #3 106 | std_OPEN_ALWAYS: 107 | .long 4 #4 108 | std_TRUNCATE_EXISTING: 109 | .long 4 #4 110 | std_FILE_ATTRIBUTE_NORMAL: 111 | .long 128 #128 112 | std_FILE_ATTRIBUTE_FOLDER: 113 | .long 16 #16 114 | std_MAXIMUM_PATH_LENGTH: 115 | .long 260 #260 116 | std_ERROR_INSUFFICIENT_BUFFER: 117 | .long 122 #122 118 | std_MINIMUM_PROCESS_FILENAME_LENGTH: 119 | .long 50 #50 120 | -------------------------------------------------------------------------------- /Tests/IO/destructor.e.asm: -------------------------------------------------------------------------------- 1 | .intel_syntax noprefix 2 | .global _Z10Start_Testv 3 | .global _Z4mainv 4 | .section .text #.text 5 | _Z4mainv: 6 | push rsi #rsi 7 | push rdi #rdi 8 | push rbx #rbx 9 | sub rsp, 16 #.STACK, 16 10 | mov ecx, 8 #REG_8_Parameter3035, 8 11 | call _V17internal_allocatex_rPh 12 | mov rcx, rax #internal_allocate_TMP_2242078961568, RetREG_0 13 | add qword ptr [rcx + 0 ], 1 #internal_allocate_TMP_2242078961568_0, 1 14 | mov rbx, rcx #Return_Value104_106, internal_allocate_TMP_2242078961568 15 | jmp Return_Here_141 #Return_Here_141 16 | Return_Here_141: 17 | mov rcx, rbx #Return_Value104_106_TMP_2242078963360, Return_Value104_106 18 | add qword ptr [rcx + 0 ], 1 #Return_Value104_106_TMP_2242078963360_0, 1 19 | mov rdi, rcx #this_105_106, Return_Value104_106_TMP_2242078963360 20 | mov rdi, rbx #this_105_106, Return_Value104_106 21 | mov dword ptr [rdi + 8 ], 1 #this_105_106_8, 1 22 | mov dword ptr [rdi + 12 ], 2 #this_105_106_12, 2 23 | mov rcx, rdi #this_105_106_TMP_2242078985760, this_105_106 24 | add qword ptr [rcx + 0 ], 1 #this_105_106_TMP_2242078985760_0, 1 25 | mov rsi, rcx #Return_Value105_106, this_105_106_TMP_2242078985760 26 | mov rsi, rdi #Return_Value105_106, this_105_106 27 | jmp Return_Here_142 #Return_Here_142 28 | Return_Here_142: 29 | mov rcx, qword ptr [rsi + 0 ] #REG_Return_Value105_10608, Return_Value105_106_0 30 | mov qword ptr [rsp + 0 + 0 ], rcx #+_0, REG_Return_Value105_10608 31 | mov rcx, qword ptr [rsi + 8 ] #REG_Return_Value105_10618, Return_Value105_106_8 32 | mov qword ptr [rsp + 0 + 8 ], rcx #+_8, REG_Return_Value105_10618 33 | lea rcx, qword ptr [rsp + 0 ] #F_106_REG1, .STACK_0 34 | mov rcx, rcx #F_106_TMP_2242078993824, F_106_REG1 35 | add qword ptr [rcx + 0 ], 1 #F_106_TMP_2242078993824_0, 1 36 | mov rcx, rcx #handle_1_106, F_106_TMP_2242078993824 37 | mov r8d, dword ptr [rcx + 8 ] #handle_1_106_8_REG2, handle_1_106_8 38 | mov r8d, r8d #x_106, handle_1_106_8_REG2 39 | mov rcx, rcx #REG_handle_1_106_Parameter22190, handle_1_106 40 | call _ZN3foo10DestructorEP3foo 41 | mov rcx, rbx #REG_Return_Value104_106_Parameter1842, Return_Value104_106 42 | call _ZN3foo10DestructorEP3foo 43 | mov rcx, rsi #REG_Return_Value105_106_Parameter288, Return_Value105_106 44 | call _ZN3foo10DestructorEP3foo 45 | mov rcx, rdi #REG_this_105_106_Parameter30106, this_105_106 46 | call _ZN3foo10DestructorEP3foo 47 | jmp Return_Here_140 #Return_Here_140 48 | Return_Here_140: 49 | mov eax, 1 #Returning_REG7, 1 50 | add rsp, 16 #.STACK, 16 51 | pop rbx #rbx 52 | pop rdi #rdi 53 | pop rsi #rsi 54 | ret # 55 | add rsp, 16 #.STACK, 16 56 | pop rbx #rbx 57 | pop rdi #rdi 58 | pop rsi #rsi 59 | ret # 60 | 61 | 62 | _Z10Start_Testv: 63 | push rbp #rbp 64 | push rsi #rsi 65 | push rdi #rdi 66 | push rbx #rbx 67 | sub rsp, 16 #.STACK, 16 68 | mov ecx, 8 #REG_8_Parameter9040, 8 69 | call _V17internal_allocatex_rPh 70 | mov rcx, rax #internal_allocate_TMP_2242079015328, RetREG_0 71 | add qword ptr [rcx + 0 ], 1 #internal_allocate_TMP_2242079015328_0, 1 72 | mov rbx, rcx #Return_Value104, internal_allocate_TMP_2242079015328 73 | jmp Return_Here_138 #Return_Here_138 74 | Return_Here_138: 75 | mov rcx, rbx #Return_Value104_TMP_2242079018016, Return_Value104 76 | add qword ptr [rcx + 0 ], 1 #Return_Value104_TMP_2242079018016_0, 1 77 | mov rdi, rcx #this_105, Return_Value104_TMP_2242079018016 78 | mov rdi, rbx #this_105, Return_Value104 79 | mov dword ptr [rdi + 8 ], 1 #this_105_8, 1 80 | mov dword ptr [rdi + 12 ], 2 #this_105_12, 2 81 | mov rcx, rdi #this_105_TMP_2242079059232, this_105 82 | add qword ptr [rcx + 0 ], 1 #this_105_TMP_2242079059232_0, 1 83 | mov rsi, rcx #Return_Value105, this_105_TMP_2242079059232 84 | mov rsi, rdi #Return_Value105, this_105 85 | jmp Return_Here_139 #Return_Here_139 86 | Return_Here_139: 87 | mov rcx, qword ptr [rsi + 0 ] #REG_Return_Value10508, Return_Value105_0 88 | mov qword ptr [rsp + 0 + 0 ], rcx #+_0, REG_Return_Value10508 89 | mov rcx, qword ptr [rsi + 8 ] #REG_Return_Value10518, Return_Value105_8 90 | mov qword ptr [rsp + 0 + 8 ], rcx #+_8, REG_Return_Value10518 91 | lea rcx, qword ptr [rsp + 0 ] #F_REG1, .STACK_0 92 | mov rcx, rcx #F_TMP_2242079044896, F_REG1 93 | add qword ptr [rcx + 0 ], 1 #F_TMP_2242079044896_0, 1 94 | mov rcx, rcx #handle_1, F_TMP_2242079044896 95 | mov r8d, dword ptr [rcx + 8 ] #handle_1_8_REG2, handle_1_8 96 | mov ebp, r8d #x, handle_1_8_REG2 97 | mov rcx, rcx #REG_handle_1_Parameter8942, handle_1 98 | call _ZN3foo10DestructorEP3foo 99 | mov rcx, rbx #REG_Return_Value104_Parameter19264, Return_Value104 100 | call _ZN3foo10DestructorEP3foo 101 | mov rcx, rsi #REG_Return_Value105_Parameter22648, Return_Value105 102 | call _ZN3foo10DestructorEP3foo 103 | mov rcx, rdi #REG_this_105_Parameter27446, this_105 104 | call _ZN3foo10DestructorEP3foo 105 | mov eax, ebp #Returning_REG7, x 106 | add rsp, 16 #.STACK, 16 107 | pop rbx #rbx 108 | pop rdi #rdi 109 | pop rsi #rsi 110 | pop rbp #rbp 111 | ret # 112 | add rsp, 16 #.STACK, 16 113 | pop rbx #rbx 114 | pop rdi #rdi 115 | pop rsi #rsi 116 | pop rbp #rbp 117 | ret # 118 | 119 | 120 | _ZN3foo10DestructorEP3foo: 121 | push rbx #rbx 122 | if_16: 123 | cmp rcx, 0 #this, 0 124 | je if_16_END #if_16_END 125 | mov r8, qword ptr [rcx + 0 ] #this_0_REG0, this_0 126 | sub r8, 1 #this_0_REG0, 1 127 | cmp r8, 1 #this_0_REG0, 1 128 | jge if_16_END #if_16_END 129 | mov r8, rcx #this_TMP_2242079075360, this 130 | add qword ptr [r8 + 0 ], 1 #this_TMP_2242079075360_0, 1 131 | mov rbx, r8 #Address_103, this_TMP_2242079075360 132 | mov rbx, rcx #Address_103, this 133 | mov rcx, rbx #REG_Address_103_Parameter23805, Address_103 134 | mov edx, 8 #REG_8_Parameter15890, 8 135 | call _V19internal_deallocatePhx 136 | Return_Here_137: 137 | mov rcx, rbx #REG_Address_103_Parameter6729, Address_103 138 | call _ZN3foo10DestructorEP3foo 139 | if_16_END: 140 | pop rbx #rbx 141 | ret # 142 | 143 | 144 | .section .data #.data 145 | std_MAX_CONSOLE_BUFFER_LENGHT: 146 | .long 4096 #4096 147 | std_GENERIC_WRITE: 148 | .long 1073741824 #1073741824 149 | std_GENERIC_READ: 150 | .quad 2147483648 #2147483648 151 | std_FILE_SHARE_NONE: 152 | .long 0 #0 153 | std_FILE_SHARE_READ: 154 | .long 1 #1 155 | std_FILE_SHARE_WRITE: 156 | .long 2 #2 157 | std_FILE_SHARE_DELETE: 158 | .long 4 #4 159 | std_CREATE_NEW: 160 | .long 1 #1 161 | std_CREATE_ALWAYS: 162 | .long 2 #2 163 | std_OPEN_EXISTING: 164 | .long 3 #3 165 | std_OPEN_ALWAYS: 166 | .long 4 #4 167 | std_TRUNCATE_EXISTING: 168 | .long 4 #4 169 | std_FILE_ATTRIBUTE_NORMAL: 170 | .long 128 #128 171 | std_FILE_ATTRIBUTE_FOLDER: 172 | .long 16 #16 173 | std_MAXIMUM_PATH_LENGTH: 174 | .long 260 #260 175 | std_ERROR_INSUFFICIENT_BUFFER: 176 | .long 122 #122 177 | std_MINIMUM_PROCESS_FILENAME_LENGTH: 178 | .long 50 #50 179 | -------------------------------------------------------------------------------- /Tests/Unit_Tests.cpp: -------------------------------------------------------------------------------- 1 | #include "H/Test_Lexer.h" 2 | #include "H/Test_Back_End.h" 3 | #include "../H/UI/Safe.h" 4 | #include "../H/UI/Usr.h" 5 | 6 | extern const string Magenta; 7 | extern const string Reset; 8 | string VT_API = ""; 9 | 10 | #ifdef Test 11 | int main(int argc, const char** argv) { 12 | Usr tmp(argv, argc); 13 | VT_API = tmp.Info.VT_API; 14 | cout << Magenta << "Lexer tests:" << Reset << endl; 15 | //Lexer_Test L_Test; 16 | cout << Magenta << "\n\nBack end tests:" << Reset << endl; 17 | 18 | string Location = argv[0]; 19 | 20 | Back_End_Test B_Test(Location); 21 | return 0; 22 | } 23 | #endif --------------------------------------------------------------------------------