Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
976709a
wip
NiZe42 Aug 28, 2025
962a012
fix hashed_string, move notes.cpp to outside of the project
GlynLeine Aug 28, 2025
649c171
update rsl to get argh
GlynLeine Aug 28, 2025
ce30cac
Update rsl
NiZe42 Aug 28, 2025
d85b8d5
Merge remote-tracking branch 'origin/main'
NiZe42 Aug 28, 2025
c6661fa
update rsl
GlynLeine Aug 28, 2025
703a691
Merge branch 'main' of https://github.com/Rythe-Interactive/reflectio…
GlynLeine Aug 28, 2025
ad2f7c0
added working AST
NiZe42 Sep 4, 2025
a703465
added parameters
NiZe42 Sep 5, 2025
5d4713e
rsl::cli_parser alias
GlynLeine Sep 8, 2025
0011ea3
broken codegen
NiZe42 Sep 9, 2025
2d88278
Merge branch 'main' of https://github.com/Rythe-Interactive/reflectio…
NiZe42 Sep 9, 2025
dada67b
wip
NiZe42 Sep 12, 2025
1211ae8
update rsl
GlynLeine Sep 15, 2025
fbe1f85
wip
NiZe42 Sep 15, 2025
a989037
update rsl again
GlynLeine Sep 15, 2025
291ea76
wip broken print
NiZe42 Sep 15, 2025
f0e3701
update rsl, rbs, and set debug args in project
GlynLeine Sep 15, 2025
e890759
update rsl
GlynLeine Sep 15, 2025
ba17054
small suggestion
GlynLeine Sep 16, 2025
e236e0b
works for hashed string too
GlynLeine Sep 16, 2025
561eb14
WIP
NiZe42 Sep 22, 2025
0323990
started adding compile reflection
NiZe42 Sep 22, 2025
0b064a1
not compiling variable container
NiZe42 Sep 23, 2025
da5308d
Started reworking parser yet again.
NiZe42 Sep 24, 2025
f3a2294
changed some more code style, continued with restructure
NiZe42 Sep 25, 2025
1269573
some minor review notes
GlynLeine Sep 25, 2025
9e913f5
almost done ast_parser
NiZe42 Sep 25, 2025
617706a
Merge branch 'main' of https://github.com/Rythe-Interactive/reflectio…
NiZe42 Sep 25, 2025
88878ba
added comments back in, fixed a little error
NiZe42 Sep 25, 2025
fb29c5c
Implemented templates for containers
NiZe42 Oct 1, 2025
10f00e9
wip printing, added base element class
NiZe42 Oct 1, 2025
097dd6d
working parser with printing
NiZe42 Oct 2, 2025
22a031a
little print improvement
NiZe42 Oct 3, 2025
005669b
started code_gen
NiZe42 Oct 9, 2025
f3cc14a
added hashing
NiZe42 Oct 10, 2025
0023950
WIP not working code gen
NiZe42 Oct 14, 2025
3746067
implemented reviews
NiZe42 Oct 16, 2025
fc81672
WIP hashing system
NiZe42 Oct 17, 2025
7aa6a4c
WIP still broken hashing
NiZe42 Oct 20, 2025
5485e1d
finished hashing
NiZe42 Oct 21, 2025
ade8f67
added const to constructors
NiZe42 Oct 21, 2025
31f27f3
fixed hashing bugs
NiZe42 Oct 24, 2025
dc954b3
WIP
NiZe42 Oct 27, 2025
35ca05d
continued codegen
NiZe42 Oct 29, 2025
733a099
fix bug
NiZe42 Oct 29, 2025
9e1950c
Almost working code gen
NiZe42 Dec 31, 2025
974f900
Code generation
NiZe42 Jan 1, 2026
d5b27c9
Fixed move bug
NiZe42 Jan 1, 2026
9c90d89
almost working runtime reflection
NiZe42 Jan 11, 2026
7abbe89
small fix
NiZe42 Jan 11, 2026
97b8509
fix msvc compilation
GlynLeine Jan 11, 2026
6112d37
little fixes
NiZe42 Jan 11, 2026
dc20a8b
Merge branch 'main' of https://github.com/Rythe-Interactive/reflectio…
NiZe42 Jan 11, 2026
c435162
add target_class2 back in
GlynLeine Jan 11, 2026
ec6fcf5
Extracted refl-core
NiZe42 Feb 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions StructurePlan.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
1 From AST (with clang lib) generate:
generated.cpp
generated.hpp
with proper members
Have a cash system which will partially generate things
Add it all to global context and expose it per module.

Having as multiple .cpp and .hpp files does feel significantly better performance wise as it would allow to not recompile everything when something is changed and make it modular. In addition we would be able to remove need for registry if generated.hpp file would hold a reference to metadata. The downside is having a lot of files. BUT THREAAADING CAN BE IMPLEMENTED TO MAKE IT PARALLEL.

Add supported list of attributes to our precompiler step, which will give warning based on if it is in there already or not.

LLVM + clang; parse AST myself

2 During compilation populate unordered map with type - members

Different types and info we need to keep track of:
Expand All @@ -16,6 +19,7 @@ Different types and info we need to keep track of:
4 Functions: -//-, const, static, virtual and co, pointer to function,
5 Template instances: our concept thing, member functions and variables, allignment, size, name with parameters,
6 Enums: underlying type, scoped?, values
7 unions?


If we implement inheritance reflected_member - we will incur 8*virtual_func_num hidden bytes
Expand All @@ -25,3 +29,13 @@ Need to figure out which modifiers exactly can be used in the future.
Need to add a way to manually add reflections.

buffer_string,dynamic string

Need to include namespace into strings

For choices: Hash function, hash structure, compile vs runtime containers

For choices, where to store runtime reflection data - BSS vs Heap vs Stack

Names are made from recursive parents. No runtime reflected namespaces objects.

Had multiple parsing iterations.
3 changes: 2 additions & 1 deletion VisualStudio22-All.bat
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
rythe-build-system\premake5 --file=rythe-build-system/premake5.lua vs2022 --workspace-name=reflection-experiments
rythe-build-system\premake5 --file=rythe-build-system/premake5.lua vs2022 --workspace-name=reflection-experiments
pause
11 changes: 2 additions & 9 deletions applications/reflection-experiments/.rythe_project
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,9 @@ local fs = dofile("filesystem.lua")

local project = {
additional_types = { "test" },
dependencies = { "public rythe/rythe-standard-library", "private third_party/clang-c:header-only" },
dependencies = { "public rythe/rythe-standard-library", "private third_party/clang-c:header-only",
"private third_party/xxhash", "public rythe/reflection-core"},
additional_link_targets = { "libclang" },
}

function project.init(proj, context)
local targetDir = fs.sanitize(fs.parentPath(_MAIN_SCRIPT_DIR) .. "/build/" .. _ACTION) .. fs.getPathSeperator()
local srcDir = fs.sanitize(fs.parentPath(_MAIN_SCRIPT_DIR) .. "/" .. proj.location .. "/src/test.hpp")
proj.post_build = { "xcopy \"" .. srcDir .. "\" \"" .. targetDir .. "\" /i /r /y /s /c" }

return proj
end

return project

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

32 changes: 31 additions & 1 deletion applications/reflection-experiments/src/source.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,34 @@
#include <unordered_set>

int main() {
#include <rsl/cli>

#include "impl/reflection_parsers/ast_source_parser.h"
#include "impl/reflection_context/reflection_context.h"
#include "impl/reflection_context/reflection_registration_registry.h"
//#include "target/test_generated.hpp"

int main(int, char* argv[])
{
rsl::cli_parser cmdl(argv);

// any particular reason for unordered_set?
std::unordered_set<std::string> folders;

for(auto& param : cmdl.params("fpath"))
{
std::cout << '\t' << param.first << " : " << param.second << '\n';
folders.insert(param.second);
}

auto parser = reflection_parsers::ast_source_parser();

parser.generate_reflection_files(folders);
reflection_registration_registry::instance().clear();
//register_reflection_file_0();
reflection_registration_registry::instance().run_all();
// lala
reflection_context::instance().print_classes();


return 0;
}
34 changes: 34 additions & 0 deletions applications/reflection-experiments/src/target/test.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
class very_cool_target_class
{
public:
int int_variable;

float variable;

void void_function(int int_parameter);

class nested_class
{
public:
nested_class() : value(0) {}

void set_value(int v) { value = v; }

int get_value() const { return value; }
private:
int value;
};

private:
char char_variable;
};

class target_class2
{
public:
int int_variable2;

void void_function2(int int_parameter);
private:
char char_variable2;
};
72 changes: 72 additions & 0 deletions applications/reflection-experiments/src/target/test_generated.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#include "../runtime_reflection_containers/runtime_reflected_class.h"
#include "../runtime_reflection_containers/runtime_reflected_function.h"
#include "../runtime_reflection_containers/runtime_reflected_variable.h"
#include "../reflection_id/reflection_id.h"
#include "../reflection_context/reflection_registration_registry.h"
#include "../reflection_context/reflection_context.h"
void register_reflection_file_0()
{
runtime_reflected_class class_14985410343605238495;
class_14985410343605238495.id = reflection_id(1644627251862529318ULL, 13483286640053009272ULL, 14985410343605238495ULL);
class_14985410343605238495.type_spelling = rsl::dynamic_string::from_string_length("very_cool_target_class");

runtime_reflected_variable variable_6501503083828029313;
variable_6501503083828029313.id = reflection_id(10933754376540684078ULL, 16350452351519940193ULL, 6501503083828029313ULL);
variable_6501503083828029313.offset = 0;
variable_6501503083828029313.type_spelling = rsl::dynamic_string::from_string_length("int");
class_14985410343605238495.add_variable(std::move(variable_6501503083828029313));

runtime_reflected_variable variable_126163732700301715;
variable_126163732700301715.id = reflection_id(5770744143431503129ULL, 12913254394975708779ULL, 126163732700301715ULL);
variable_126163732700301715.offset = 4;
variable_126163732700301715.type_spelling = rsl::dynamic_string::from_string_length("float");
class_14985410343605238495.add_variable(std::move(variable_126163732700301715));

runtime_reflected_variable variable_17337086075296791468;
variable_17337086075296791468.id = reflection_id(15779825311949492597ULL, 9221959329564397894ULL, 17337086075296791468ULL);
variable_17337086075296791468.offset = 8;
variable_17337086075296791468.type_spelling = rsl::dynamic_string::from_string_length("char");
class_14985410343605238495.add_variable(std::move(variable_17337086075296791468));

runtime_reflected_class class_3168970719907517523;
class_3168970719907517523.id = reflection_id(8627741348740311923ULL, 10691473971882747459ULL, 3168970719907517523ULL);
class_3168970719907517523.type_spelling = rsl::dynamic_string::from_string_length("nested_class");

runtime_reflected_variable variable_9809713342160364025;
variable_9809713342160364025.id = reflection_id(785375445157317512ULL, 16350452351519940193ULL, 9809713342160364025ULL);
variable_9809713342160364025.offset = 0;
variable_9809713342160364025.type_spelling = rsl::dynamic_string::from_string_length("int");
class_3168970719907517523.add_variable(std::move(variable_9809713342160364025));

class_14985410343605238495.add_class(std::move(class_3168970719907517523));

reflection_context::instance().add_class(std::move(class_14985410343605238495));

runtime_reflected_class class_862151746601595251;
class_862151746601595251.id = reflection_id(14404923345981690111ULL, 31932944099034707ULL, 862151746601595251ULL);
class_862151746601595251.type_spelling = rsl::dynamic_string::from_string_length("target_class2");

runtime_reflected_variable variable_13153249853553726320;
variable_13153249853553726320.id = reflection_id(4281340778281841492ULL, 16350452351519940193ULL, 13153249853553726320ULL);
variable_13153249853553726320.offset = 0;
variable_13153249853553726320.type_spelling = rsl::dynamic_string::from_string_length("int");
class_862151746601595251.add_variable(std::move(variable_13153249853553726320));

runtime_reflected_variable variable_6526241590453974317;
variable_6526241590453974317.id = reflection_id(10234543199726084352ULL, 9221959329564397894ULL, 6526241590453974317ULL);
variable_6526241590453974317.offset = 4;
variable_6526241590453974317.type_spelling = rsl::dynamic_string::from_string_length("char");
class_862151746601595251.add_variable(std::move(variable_6526241590453974317));

reflection_context::instance().add_class(std::move(class_862151746601595251));

};

struct reflection_file_registration_helper
{
reflection_file_registration_helper()
{
reflection_registration_registry::instance().add(&register_reflection_file_0);
}
};
static reflection_file_registration_helper registration_instance;
47 changes: 0 additions & 47 deletions applications/reflection-experiments/src/test.hpp

This file was deleted.

Loading