Details
-
Improvement
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
Description
I think it's really important to implement CFC as a Clownfish project as soon as possible. This has several benefits:
- Increases productivity and performance.
- Every additional Clownfish project helps with refinement of the runtime API.
- Documentation can be easily generated.
- Allows to share code between the runtime and compiler.
If CFC depends on the runtime and the runtime needs CFC to compile, this creates a bootstrapping problem that can be resolved as follows:
- Make the Clownfish runtime self-hosting.
- Don't create the CFC-generated files on every build.
- Add an initial version of the generated files to version control. This must de done separately for every host language.
- Only recreate these files on demand.
- cfish_platform.h is an exception. Provide a static version that includes charmony.h and uses the CHY macros directly.
- Make the Clownfish runtime available to CFC.
- Generate Clownfish runtime headers and add them to CFC version control to make CFC self-hosting like the runtime.
- Link CFC against the Clownfish runtime.
Then we could proceed and
- Switch CFC over to Clownfish strings.
- Start with high-level functions like CFCUtil_write_file. Work downwards to lower-level functions.
- Implement CFC classes as Clownfish classes. This can be done base class by base class.
Working on the .cfh files of the compiler would look like this:
- Keep a CFC binary from a previous build around.
- Change .cfh files and rebuild the generated files using the old CFC binary.
- Rebuild CFC.
- Recreate the the generated files using the the freshly built CFC.
- Check whether output is OK.
- Commit changes to generated files.