Per my note in #12, I think we should reorganize the crates in this project a bit and fix up the naming.
The broad strokes:
- Make sure crates are namespaced
- Make sure crates use consistent, standardized naming scheme (e.g.
pattern-compiler should be pattern_compiler, as - is a pain and has to be used as _ anyway)
- Split up executable code from supporting library code
- Merge library crates which perform similar but slightly different tasks
My specific thoughts/recommendations (in alphabetical order by crate). NOTE: I haven't fully grokked the role of each crate in the repo, so these thoughts are based mostly on my impressions of how they fit together, if adjustments are needed, that's no problem.
- Extract the Core parser from
compiler as libeir_syntax_core
- Create a new crate,
eirc which holds the executable parts of compiler
- Rename
compiler as libeir_ir, make it a library crate
- Create a new crate
libeir_passes to hold various IR passes
- Merge
cps_transform into libeir_passes
- Rename
diagnostics to libeir_diagnostics
- Rename
frontend to libeir_syntax_erl
- Merge executable parts of
gen_nif into eirc
- Extract library parts of
gen_nif into libeir_nif
- Remove
internal_lib if not used
- Rename
interpreter to libeir_eval, libeir_interpreter, or libeir_vm
- Rename
pattern-compiler to libeir_patternc, or possibly merge into libeir_passes if that makes more sense
- Merge
tools into eirc
- Rename
util to libeir_utils
I'm happy to do any/all of these, and I think the end result will be a much more cohesive crate workspace, and provide better hints to contributors on what things are, how they relate to one another.
My naming scheme/recommendations are largely based on community guidelines as well as the rust repository itself, as I've found their organization to be very helpful when navigating that code base, and it is massive. Lumen is organized this way as well, and has so far been pleasant to work with. Seems to be a good approach for compilers anyway!
Thoughts?
Per my note in #12, I think we should reorganize the crates in this project a bit and fix up the naming.
The broad strokes:
pattern-compilershould bepattern_compiler, as-is a pain and has to be used as_anyway)My specific thoughts/recommendations (in alphabetical order by crate). NOTE: I haven't fully grokked the role of each crate in the repo, so these thoughts are based mostly on my impressions of how they fit together, if adjustments are needed, that's no problem.
compileraslibeir_syntax_coreeircwhich holds the executable parts ofcompilercompileraslibeir_ir, make it a library cratelibeir_passesto hold various IR passescps_transformintolibeir_passesdiagnosticstolibeir_diagnosticsfrontendtolibeir_syntax_erlgen_nifintoeircgen_nifintolibeir_nifinternal_libif not usedinterpretertolibeir_eval,libeir_interpreter, orlibeir_vmpattern-compilertolibeir_patternc, or possibly merge intolibeir_passesif that makes more sensetoolsintoeircutiltolibeir_utilsI'm happy to do any/all of these, and I think the end result will be a much more cohesive crate workspace, and provide better hints to contributors on what things are, how they relate to one another.
My naming scheme/recommendations are largely based on community guidelines as well as the
rustrepository itself, as I've found their organization to be very helpful when navigating that code base, and it is massive. Lumen is organized this way as well, and has so far been pleasant to work with. Seems to be a good approach for compilers anyway!Thoughts?