root/v6/v6-KindaPerl6/docs/NOTES-NEW-COMPILER.txt

Revision 18045, 2.2 kB (checked in by fglock, 15 months ago)

[kp6] set svk eol, mime-type properties

  • Property svn:mime-type set to text/plain; charset=UTF-8
  • Property svn:eol-style set to native
Line 
1The idea for writing a new compiler came from the need to a better
2separation of the compilation process and the compilation
3runtime. This is needed because eventually, the runtime for each
4platform may be completely different from the others. This way this
5new compiler will define an API that the compiler can call to the
6Runtime virtual machine in a way to make it more pluggable.
7
8KindaPerl6::VirtualMachine is the namespace for the API that is
9called. The calling convention for this namespace follows the calling
10convention of the "host" implementation, so, if the Perl5
11implementation uses a dispatch mechanism, the
12KindaPerl6::VirtualMachine::Perl5 implementation should use that. On
13the other hand in Parrot, it will probably use the Parrot's calling
14convention.
15
16The same way that there are different VM implementations, the Emitting
17process is also pluggable itself, allowing the writing of a
18cross-compiler. This way, the "Perl5", "Perl5rx" and "Parrot"
19implementations are considered "architecture".
20
21The compiler plugins, like alternative rule compilation must be
22available in the host architecture to be used. This plugins may add
23opaque data to the compilation process which will be recognized by the
24emitter phase.
25
26The following diagram illustrates the process:
27
28<COMPILATION_PROCESS.dia>
29
30Files:
31
32YAP6::Compiler - This is the main class, that contains the code
33to initiate the compilation process. By default it will use all the
34options used to compile it. It's the entrance to define also which
35plugins are loaded and which target will be used.
36
37YAP6::VirtualMachine - This is the API to access the runtime not
38only in the compilation phase, but also during code execution. This is
39a procedural interface to the VM. Only one is available at a time and
40contains all the runtime information needed. Symbol definitions are
41all made here. This symbol definitions can point to low-level defined
42objects, to compiled objects or even to nodes in the AST. For targets
43that allow bytecode generation, the runtime needs to be serializable.
44
45YAP6::AST - This is the OO representatino of the Abstract Syntax
46Tree inside the compiler. This should be back-end independent. And
47every target should be able to run it instantly or generate code for it.
Note: See TracBrowser for help on using the browser.