I make several porting projects, regularly as my job in this decades (including learning new language along it), so some tips, adjusting for the fact this is C (auch!):
- Learn well a modern lang (Rust, Zig, Modern C?, ... lets call it the porting LANG).
If you are not a OLD HAT C developer and was "raised" in more modern things, going straight to some modern alternative to C (Rust, Zig, ...) could pay off much more if you are really for the long term.
This not replace the fact you need to know enough C to learn this, but is for your sanity long term (You can disregard this if plan to be a C developer for long).
Is important because:
- Collect a list of requirements and dependencies. C requiere to recreate a lot of basic stuff (like hash, strings, etc).
You can certainly throw all of that. Even if that implementation has some useful property, you don't need that burden (re-implement that) right know.
Modern langs also have better idioms to use memory (no manual mallocs!) and that is another burden that is not worth long term.
p.d: For what I see, this project has TOO BIG of a "re-creating basic stuff that any sane lang has in their std library" than actual code for make the idea work. So spend time there is lost time, IMHO). If stay on C, look for already-implemented alternatives that let you focus in the main tasks.
- Eliminate/Simplify your tooling. If CMake sucks, it sucks. Replace it with the most sane alternative for your LANG.
- Prepare yourself for quickly and merciless refactoring all, all the time. The faster you get in the cycle of "attempt understand, implement, test, rewrite, restart" the better.
All the above is to improve your velocity at the start or in the long term.
In no particular order:
- Put a debugger. Step in the code.
- If you manage to compile the old code, and knowing this is a lang, you have a good chance to make this great for testing: Input STDIN and output STDOUT and use that to confirm things!
- Collect a "call tree" using any means (notes, a tree editor, etc).
Implement things in a new blank project, and write the functions. Be sure you understand the small steps. When stuck, create another mini project and try to pull the idea alone.
This is harder than "just move forward" but the point is that you need to understand the project, not just make it compile, right?
- DO NOT punish yourself if the porting is not 100% exact.
Is more important to match "outcomes" than "exact outputs". Is very likely that you hit a bug or a hack and recreating that stuff is not worth in this case, IMHO.
- Ask things to the community! Go into a good place where discuss stuff for your LANG and ask for help. Also, you can consider go into places like https://www.reddit.com/r/ProgrammingLanguages/ for META questions about language development & paradigms.
P.D: Consider this ideas as not replacements for the others in this thread, just extra things to consider!