Pliant bootstrapping code
This documents explains how to dig in the Pliant bootstrapping code written in C.
Pliant C part configuration
Some constants specifying the environment, such as _GCC_ or _LINUX_ or _REGISTERS_ are defined directly in the script used to compile Pliant executables. Theses scripts are in /pliant/language/install/
Since Pliant is a true compiler, it needs to know how to generate the code for passing parameters to the function to be called. The calling conventions are surprisingly not processor related but rather C compiler and OS related, so a /pliant/language/declare/call.c module is defining extra constants providing detailed description of the compiler calling conventions.
Then, extra constants and C structures are defined in /pliant/language/declare/struct.c
The prototype of various C written functions of Pliant bootstrapping code is provided in /pliant/language/declare/proto.c because modern C compilers don't like (basic sanity check) calling functions they have not previously received the prototype of. A few constants also landed here.
Pliant process startup sequence
Assuming that the Pliant bootstrap executables have been compiled using GCC, just after loading the executable, control will be transfered to /pliant/language/startup/start.s
Then, control is transfered to a function (sometime named 'pliant', sometime 'main', sometime 'startup' depending on the execution model) at the beginning of /pliant/language/startup/startup.c
'initialize' (also in /pliant/language/startup/startup.c) is a very important function to understand the layout of the Pliant C bootstrapping code.
Why is there a part of Pliant written in C, instead of self compiling Pliant compiler ?
In the early days, you need to write the compiler in another language to get something running. Then, with static languages such a C you can rewrite the compiler code in the new language itself and use the new language compiler to compile itself. It's a bit more complicated for a dynamic language like Pliant because Pliant compiler never outputs an executable, so I would have to use a modified version of Pliant compiler that generates C, assembly or an ELF executable.