summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2026-01-12 12:10:32 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2026-01-12 12:11:20 +0100
commitff7ee3e3e070a2abee70fd93062065060118cf9e (patch)
tree2718e81141bc32ac272b77f67e7e381f4ae68dbf
parentcce0f5c05980c0f51348536192e5527a0828940c (diff)
chore: wip: Introduce `libNectarStd`'s Generics Library.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
-rw-r--r--include/LibNectarRuntime/.keep0
-rw-r--r--include/LibNectarStd/iostream.ncpp19
-rw-r--r--include/LibNectarStd/iterator.ncpp13
-rw-r--r--src/CompilerKit/src/Preprocessor/Preprocessor+Generic.cc17
-rw-r--r--test/test_samples/iostream.ncpp9
-rw-r--r--test/test_samples/ostream_test.ncpp39
-rw-r--r--test/test_samples/return_value.ncpp6
7 files changed, 51 insertions, 52 deletions
diff --git a/include/LibNectarRuntime/.keep b/include/LibNectarRuntime/.keep
deleted file mode 100644
index e69de29..0000000
--- a/include/LibNectarRuntime/.keep
+++ /dev/null
diff --git a/include/LibNectarStd/iostream.ncpp b/include/LibNectarStd/iostream.ncpp
new file mode 100644
index 0000000..ecd1132
--- /dev/null
+++ b/include/LibNectarStd/iostream.ncpp
@@ -0,0 +1,19 @@
+// Copyright 2026, Amlal El Mahrouss (amlal@nekernel.org)
+// Licensed under the Apache License, Version 2.0 (See accompanying
+// file LICENSE or copy at http://www.apache.org/licenses/LICENSE-2.0)
+// Official repository: https://github.com/nekernel-org/nectar
+
+import printf, scanf;
+
+struct ostream
+{
+ let print(let data)
+ {
+ return nil;
+ }
+
+ let scan(let fmt)
+ {
+ return nil;
+ }
+}; \ No newline at end of file
diff --git a/include/LibNectarStd/iterator.ncpp b/include/LibNectarStd/iterator.ncpp
new file mode 100644
index 0000000..fe9015d
--- /dev/null
+++ b/include/LibNectarStd/iterator.ncpp
@@ -0,0 +1,13 @@
+
+struct iterator
+{
+ let begin(let collection)
+ {
+ return nil;
+ }
+
+ let end(let collection)
+ {
+ return nil;
+ }
+}; \ No newline at end of file
diff --git a/src/CompilerKit/src/Preprocessor/Preprocessor+Generic.cc b/src/CompilerKit/src/Preprocessor/Preprocessor+Generic.cc
index efaee88..7b3c219 100644
--- a/src/CompilerKit/src/Preprocessor/Preprocessor+Generic.cc
+++ b/src/CompilerKit/src/Preprocessor/Preprocessor+Generic.cc
@@ -805,21 +805,12 @@ NECTAR_MODULE(GenericPreprocessorMain) {
kMacros.push_back(macro_lang);
- Detail::bpp_macro macro_size_t;
- macro_size_t.fName = "__SIZE_TYPE__";
- macro_size_t.fValue = "unsigned long long int";
+ Detail::bpp_macro macro_nil;
- kMacros.push_back(macro_size_t);
+ macro_nil.fName = "nil";
+ macro_nil.fValue = "0";
- macro_size_t.fName = "__UINT32_TYPE__";
- macro_size_t.fValue = "unsigned int";
-
- kMacros.push_back(macro_size_t);
-
- macro_size_t.fName = "__UINTPTR_TYPE__";
- macro_size_t.fValue = "unsigned long long int";
-
- kMacros.push_back(macro_size_t);
+ kMacros.push_back(macro_nil);
for (auto index = 1UL; index < argc; ++index) {
if (skip) {
diff --git a/test/test_samples/iostream.ncpp b/test/test_samples/iostream.ncpp
new file mode 100644
index 0000000..de1e6b8
--- /dev/null
+++ b/test/test_samples/iostream.ncpp
@@ -0,0 +1,9 @@
+import iostream;
+
+let main()
+{
+ let io = iostream{};
+ let first_number = io.read_once();
+
+ return first_number;
+} \ No newline at end of file
diff --git a/test/test_samples/ostream_test.ncpp b/test/test_samples/ostream_test.ncpp
deleted file mode 100644
index 2c4d5b2..0000000
--- a/test/test_samples/ostream_test.ncpp
+++ /dev/null
@@ -1,39 +0,0 @@
-struct iostream
-{
- iostream()
- {
- return;
- }
-
- ~iostream()
- {
- return;
- }
-
- let write(let val)
- {
- return;
- }
-
- let read()
- {
- let ch = 'a';
- return ch;
- }
-};
-
-let dread()
-{
- return 0;
-}
-
-let main()
-{
- let six_seven = 67;
-
- let io = iostream{};
- io.read();
- six_seven = dread();
-
- return six_seven;
-}
diff --git a/test/test_samples/return_value.ncpp b/test/test_samples/return_value.ncpp
new file mode 100644
index 0000000..897ca15
--- /dev/null
+++ b/test/test_samples/return_value.ncpp
@@ -0,0 +1,6 @@
+let main()
+{
+ let six_seven = 67;
+
+ return six_seven;
+}