summaryrefslogtreecommitdiffhomepage
path: root/src/CompilerKit
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2026-01-24 11:09:12 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2026-01-24 11:10:42 +0100
commit41458b7253c524db10088657c930d300fc1b09ca (patch)
treecb98672693c922866ee9c35563956d7c9e194867 /src/CompilerKit
parent0966a15e05ae1645c8e0785d6fe44a9b529be6b3 (diff)
chore: assemblers: update assembler flag.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'src/CompilerKit')
-rw-r--r--src/CompilerKit/src/Assemblers/Assembler+64x0.cc12
-rw-r--r--src/CompilerKit/src/Assemblers/Assembler+AMD64.cc16
-rw-r--r--src/CompilerKit/src/Assemblers/Assembler+ARM64.cc14
-rw-r--r--src/CompilerKit/src/Compilers/NectarCompiler+AMD64.cc30
-rw-r--r--src/CompilerKit/src/Linkers/DynamicLinker64+MachO.cc2
5 files changed, 43 insertions, 31 deletions
diff --git a/src/CompilerKit/src/Assemblers/Assembler+64x0.cc b/src/CompilerKit/src/Assemblers/Assembler+64x0.cc
index 911fd27..3fe4e9a 100644
--- a/src/CompilerKit/src/Assemblers/Assembler+64x0.cc
+++ b/src/CompilerKit/src/Assemblers/Assembler+64x0.cc
@@ -66,24 +66,24 @@ NECTAR_MODULE(AssemblerMain64x0) {
for (size_t i = 1; i < argc; ++i) {
if (argv[i][0] == '-') {
- if (strcmp(argv[i], "-64x0-ver") == 0 || strcmp(argv[i], "-64x0-v") == 0) {
+ if (strcmp(argv[i], "--version") == 0 || strcmp(argv[i], "--v") == 0) {
kStdOut
<< "Assembler64x0: 64x0 Assembler.\nAssembler64x0: v1.10\nAssembler64x0: Copyright (c) "
"Amlal El Mahrouss\n";
return 0;
- } else if (strcmp(argv[i], "-64x0-h") == 0) {
+ } else if (strcmp(argv[i], "--help") == 0) {
kStdOut << "Assembler64x0: 64x0 Assembler.\nAssembler64x0: Copyright (c) 2024 Mahrouss "
"Logic.\n";
kStdOut << "--version: Print program version.\n";
- kStdOut << "--verbose: Print verbose output.\n";
- kStdOut << "--binary: Output as flat binary.\n";
+ kStdOut << "--fverbose: Print verbose output.\n";
+ kStdOut << "--fbinary: Output as flat binary.\n";
kStdOut << "--64xxx: Compile for a subset of the X64000.\n";
return 0;
- } else if (strcmp(argv[i], "-64x0-binary") == 0) {
+ } else if (strcmp(argv[i], "--fbinary") == 0) {
kOutputAsBinary = true;
continue;
- } else if (strcmp(argv[i], "-64x0-verbose") == 0) {
+ } else if (strcmp(argv[i], "--fverbose") == 0) {
kVerbose = true;
continue;
}
diff --git a/src/CompilerKit/src/Assemblers/Assembler+AMD64.cc b/src/CompilerKit/src/Assemblers/Assembler+AMD64.cc
index 7e4f5e7..b460051 100644
--- a/src/CompilerKit/src/Assemblers/Assembler+AMD64.cc
+++ b/src/CompilerKit/src/Assemblers/Assembler+AMD64.cc
@@ -122,15 +122,15 @@ NECTAR_MODULE(AssemblerMainAMD64) {
kStdOut
<< "AssemblerAMD64: This Software is part of the NeKernel project. (nekernel.org)\n";
return 0;
- } else if (strcmp(argv[i], "-help") == 0) {
+ } else if (strcmp(argv[i], "--help") == 0) {
kStdOut
<< "AssemblerAMD64: AMD64 Assembler Driver.\nAssemblerAMD64: Copyright (c) 2024-2026 "
"Amlal El Mahrouss\n";
kStdOut
<< "AssemblerAMD64: This Software is part of the NeKernel project. (nekernel.org)\n";
kStdOut << "--version: Print program version.\n";
- kStdOut << "--verbose: Print verbose output.\n";
- kStdOut << "--binary: Output as flat binary.\n";
+ kStdOut << "--fverbose: Print verbose output.\n";
+ kStdOut << "--fbinary: Output as flat binary.\n";
return 0;
} else if (strcmp(argv[i], "--fbinary") == 0) {
@@ -452,7 +452,8 @@ static bool asm_read_attributes(std::string line) {
// \brief algorithms and helpers.
-namespace CompilerKit::Detail::algorithm {
+namespace CompilerKit::Detail::Algorithm {
+
// \brief authorize a brief set of characters.
static inline bool is_not_valid(char c) {
if ((isalpha(c) || isdigit(c)) ||
@@ -468,7 +469,8 @@ static inline bool is_not_valid(char c) {
bool is_valid_amd64(std::string str) {
return std::find_if(str.begin(), str.end(), is_not_valid) == str.end();
}
-} // namespace CompilerKit::Detail::algorithm
+
+} // namespace CompilerKit::Detail::Algorithm
/////////////////////////////////////////////////////////////////////////////////////////
@@ -487,7 +489,7 @@ std::string CompilerKit::EncoderAMD64::CheckLine(std::string line, std::string f
line.erase(line.find(';'));
} else {
// now check the line for validity
- if (!CompilerKit::Detail::algorithm::is_valid_amd64(line)) {
+ if (!CompilerKit::Detail::Algorithm::is_valid_amd64(line)) {
err_str = "Line contains non valid characters.\nhere -> ";
err_str += line;
}
@@ -916,7 +918,7 @@ bool CompilerKit::EncoderAMD64::WriteLine(std::string line, std::string file) {
for (auto& opcodeAMD64 : kOpcodesAMD64) {
// strict check here
if (CompilerKit::ast_find_needle(line, opcodeAMD64.fName) &&
- CompilerKit::Detail::algorithm::is_valid_amd64(line)) {
+ CompilerKit::Detail::Algorithm::is_valid_amd64(line)) {
foundInstruction = true;
std::string name(opcodeAMD64.fName);
diff --git a/src/CompilerKit/src/Assemblers/Assembler+ARM64.cc b/src/CompilerKit/src/Assemblers/Assembler+ARM64.cc
index fd06d4e..9957cac 100644
--- a/src/CompilerKit/src/Assemblers/Assembler+ARM64.cc
+++ b/src/CompilerKit/src/Assemblers/Assembler+ARM64.cc
@@ -71,24 +71,24 @@ NECTAR_MODULE(AssemblerMainARM64) {
for (size_t i = 1; i < argc; ++i) {
if (argv[i][0] == '-') {
- if (strcmp(argv[i], "--ver") == 0 || strcmp(argv[i], "--v") == 0) {
+ if (strcmp(argv[i], "--version") == 0 || strcmp(argv[i], "--v") == 0) {
kStdOut << "AssemblerPower: AARCH64 Assembler Driver.\nAssemblerPower: " << kDistVersion
<< "\nAssemblerPower: "
"Copyright (c) "
"Amlal El Mahrouss\n";
return 0;
- } else if (strcmp(argv[i], "--h") == 0) {
+ } else if (strcmp(argv[i], "--help") == 0) {
kStdOut << "AssemblerPower: AARCH64 Assembler Driver.\nAssemblerPower: Copyright (c) 2024 "
"Amlal El Mahrouss\n";
- kStdOut << "--version,/v: print program version.\n";
- kStdOut << "--verbose: print verbose output.\n";
- kStdOut << "--binary: output as flat binary.\n";
+ kStdOut << "--version,--v: print program version.\n";
+ kStdOut << "--fverbose: print verbose output.\n";
+ kStdOut << "--fbinary: output as flat binary.\n";
return 0;
- } else if (strcmp(argv[i], "--binary") == 0) {
+ } else if (strcmp(argv[i], "--fbinary") == 0) {
kOutputAsBinary = true;
continue;
- } else if (strcmp(argv[i], "--verbose") == 0) {
+ } else if (strcmp(argv[i], "--fverbose") == 0) {
kVerbose = true;
continue;
}
diff --git a/src/CompilerKit/src/Compilers/NectarCompiler+AMD64.cc b/src/CompilerKit/src/Compilers/NectarCompiler+AMD64.cc
index 25349ad..dfca499 100644
--- a/src/CompilerKit/src/Compilers/NectarCompiler+AMD64.cc
+++ b/src/CompilerKit/src/Compilers/NectarCompiler+AMD64.cc
@@ -285,7 +285,7 @@ static auto nectar_get_impl_member(const CompilerKit::STLString& class_name,
CompilerKit::SyntaxLeafList::SyntaxLeaf CompilerFrontendNectarAMD64::Compile(
CompilerKit::STLString& text, const CompilerKit::STLString& file) {
CompilerKit::SyntaxLeafList::SyntaxLeaf syntax_tree;
- CompilerKit::STLString syntax_rem_buffer;
+ CompilerKit::STLString syntax_rem_buffer;
if (text.empty()) return syntax_tree;
@@ -865,34 +865,44 @@ CompilerKit::SyntaxLeafList::SyntaxLeaf CompilerFrontendNectarAMD64::Compile(
case CompilerKit::KeywordKind::kKeywordKindImport: {
auto tmp = text;
- if (tmp.find(";") != CompilerKit::STLString::npos)
- tmp.erase(tmp.find(";"));
+ if (tmp.find(";") != CompilerKit::STLString::npos) tmp.erase(tmp.find(";"));
while (tmp.find(" ") != CompilerKit::STLString::npos) {
tmp.erase(tmp.find(" "), 1);
}
if (!kNasmOutput)
- syntax_tree.fUserValue += "extern_segment .zero64 _" + tmp.substr(tmp.find(keyword.first.fKeywordName) + keyword.first.fKeywordName.size()) + "\n";
+ syntax_tree.fUserValue +=
+ "extern_segment .zero64 _" +
+ tmp.substr(tmp.find(keyword.first.fKeywordName) + keyword.first.fKeywordName.size()) +
+ "\n";
else
- syntax_tree.fUserValue += "section .data\nextern _" + tmp.substr(tmp.find(keyword.first.fKeywordName) + keyword.first.fKeywordName.size()) + "\n";
+ syntax_tree.fUserValue +=
+ "section .data\nextern _" +
+ tmp.substr(tmp.find(keyword.first.fKeywordName) + keyword.first.fKeywordName.size()) +
+ "\n";
break;
}
case CompilerKit::KeywordKind::kKeywordKindExtern: {
auto tmp = text;
- if (tmp.find(";") != CompilerKit::STLString::npos)
- tmp.erase(tmp.find(";"));
+ if (tmp.find(";") != CompilerKit::STLString::npos) tmp.erase(tmp.find(";"));
while (tmp.find(" ") != CompilerKit::STLString::npos) {
tmp.erase(tmp.find(" "), 1);
}
-
+
if (!kNasmOutput)
- syntax_tree.fUserValue += "extern_segment .code64 _" + tmp.substr(tmp.find(keyword.first.fKeywordName) + keyword.first.fKeywordName.size()) + "\n";
+ syntax_tree.fUserValue +=
+ "extern_segment .code64 _" +
+ tmp.substr(tmp.find(keyword.first.fKeywordName) + keyword.first.fKeywordName.size()) +
+ "\n";
else
- syntax_tree.fUserValue += "section .text\nextern _" + tmp.substr(tmp.find(keyword.first.fKeywordName) + keyword.first.fKeywordName.size()) + "\n";
+ syntax_tree.fUserValue +=
+ "section .text\nextern _" +
+ tmp.substr(tmp.find(keyword.first.fKeywordName) + keyword.first.fKeywordName.size()) +
+ "\n";
break;
}
diff --git a/src/CompilerKit/src/Linkers/DynamicLinker64+MachO.cc b/src/CompilerKit/src/Linkers/DynamicLinker64+MachO.cc
index 3a57723..b8ee813 100644
--- a/src/CompilerKit/src/Linkers/DynamicLinker64+MachO.cc
+++ b/src/CompilerKit/src/Linkers/DynamicLinker64+MachO.cc
@@ -87,7 +87,7 @@ static CompilerKit::STLString macho_extract_symbol_name(const CompilerKit::STLSt
/// @brief Add a symbol to the symbol table
static UInt32 macho_add_symbol(const CompilerKit::STLString& name, uint8_t type, uint8_t sect,
- UInt64 value) {
+ UInt64 value) {
// Add name to string table (offset 0 is reserved for empty string)
if (kStringTable.empty()) {
kStringTable.push_back('\0'); // First byte is null