-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
55d0710
commit b10a7df
Showing
13 changed files
with
186 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[project] | ||
name = "MyFirstProject" | ||
version = "1.0.0" | ||
|
||
[dependencies] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
fn i32 main() { | ||
return 0; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#include "Project.hpp" | ||
#include <iostream> | ||
#include <fstream> | ||
#include <filesystem> | ||
|
||
void Project::CreateTOML(std::string name) | ||
{ | ||
std::string path = name + "/Nucleus.toml"; | ||
|
||
std::string content = "[project]\n"; | ||
content += "name = \"" + name + "\"\n"; | ||
content += "version = \"1.0.0\"\n\n"; | ||
|
||
content += "[dependencies]\n\n"; | ||
|
||
//content += "[imports]\n"; | ||
//content += "folders = [\n"; | ||
//content += "\t\"Nucleus.Std\"\n"; | ||
//content += "]\n"; | ||
|
||
std::ofstream o(path.c_str()); | ||
|
||
o << content << "\n"; | ||
} | ||
|
||
void Project::CreateMainNk(std::string name) | ||
{ | ||
std::string path = name + "/main.nk"; | ||
|
||
std::string content = "fn i32 main() {\n"; | ||
content += "\treturn 0;\n"; | ||
content += "}\n"; | ||
|
||
std::ofstream o(path.c_str()); | ||
|
||
o << content << "\n"; | ||
} | ||
|
||
void Project::Create(std::string name) | ||
{ | ||
for(auto c : name) | ||
{ | ||
if(c < 32) | ||
continue; | ||
|
||
if(!isalpha(c)) | ||
{ | ||
std::cout << "Error: Sorry, but the name of the project can't have special characters, only letters and numbers are allowed!\n"; | ||
exit(1); | ||
} | ||
} | ||
|
||
if(std::filesystem::exists(name)) | ||
{ | ||
std::cout << "Error: Sorry, but the folder '" << name << "' already exists...\n"; | ||
exit(1); | ||
} | ||
|
||
std::cout << "Creating \"" << name << "\"...\n"; | ||
|
||
std::filesystem::create_directory(name); | ||
|
||
CreateTOML(name); | ||
|
||
CreateMainNk(name); | ||
|
||
std::cout << "Project \"" << name << "\" successfully created!\n"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#ifndef PROJECT_HPP | ||
#define PROJECT_HPP | ||
|
||
#include <string> | ||
|
||
struct Project | ||
{ | ||
static void Create(std::string name); | ||
static void CreateTOML(std::string name); | ||
static void CreateMainNk(std::string name); | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
/d/msys64/mingw64/bin/clang++ -g -O3 Language/*.cpp *.cpp `/d/msys64/mingw64/bin/llvm-config --cxxflags --link-static --ldflags --system-libs --libs all` -fstack-protector -lssp -frtti -std=c++20 -static -o nucleus | ||
/d/msys64/mingw64/bin/clang++ -g -O3 Language/*.cpp Tooling/*.cpp *.cpp `/d/msys64/mingw64/bin/llvm-config --cxxflags --link-static --ldflags --system-libs --libs all` -fstack-protector -lssp -frtti -std=c++20 -static -o nucleus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
; ModuleID = 'Nucleus' | ||
source_filename = "Nucleus" | ||
|
||
define i32 @addTwo() { | ||
entry: | ||
ret i32 2 | ||
} | ||
|
||
define i32 @main() { | ||
entry: | ||
%variableName = alloca i32, align 4 | ||
store i32 0, ptr %variableName, align 4 | ||
store i32 2, ptr %variableName, align 4 | ||
%variableName1 = load i32, ptr %variableName, align 4 | ||
%addtmp = add i32 %variableName1, 1 | ||
%addtmp = add i32 %variableName1, 2 | ||
store i32 %addtmp, ptr %variableName, align 4 | ||
%state1 = load i32, ptr %variableName, align 4 | ||
%addtmp2 = add i32 %state1, 1 | ||
%state2 = load i32, ptr %variableName, align 4 | ||
%addtmp3 = add i32 %state2, 2 | ||
%state3 = load i32, ptr %variableName, align 4 | ||
%addtmp4 = add i32 %state3, 3 | ||
ret i32 %addtmp2 | ||
%autoLoad = load i32, ptr %variableName, align 4 | ||
ret i32 %autoLoad | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
; ModuleID = 'Nucleus' | ||
source_filename = "Nucleus" | ||
|
||
define i32 @addTwo() { | ||
entry: | ||
ret i32 2 | ||
} | ||
|
||
define i32 @main() { | ||
entry: | ||
%variable = alloca i32, align 4 | ||
store i32 2, ptr %variable, align 4 | ||
%variable1 = load i32, ptr %variable, align 4 | ||
%addtmp = add i32 %variable1, 4 | ||
%addtmp2 = add i32 %addtmp, 6 | ||
%addtmp3 = add i32 %addtmp2, 10 | ||
store i32 %addtmp3, ptr %variable, align 4 | ||
%autoLoad = load i32, ptr %variable, align 4 | ||
%variableName = alloca i32, align 4 | ||
store i32 2, ptr %variableName, align 4 | ||
%variableName1 = load i32, ptr %variableName, align 4 | ||
%addtmp = add i32 %variableName1, 2 | ||
store i32 %addtmp, ptr %variableName, align 4 | ||
%autoLoad = load i32, ptr %variableName, align 4 | ||
ret i32 %autoLoad | ||
} |
Binary file not shown.