Self-hosting compiler: Difference between revisions
Content added Content deleted
m (flag for difficulty issues) |
(Added zkl) |
||
Line 1,282: | Line 1,282: | ||
#true |
#true |
||
(zed->scheme!) "value" nil</lang> |
(zed->scheme!) "value" nil</lang> |
||
=={{header|zkl}}== |
|||
zkl is written in zkl. The compiler is big. The VM has a compiled (C) image of the compile as a big table, ie the system is image based. Here is an example of compiling and testing a new compiler: |
|||
<pre> |
|||
$ zkl --package Src/Compiler/compiler.zkl |
|||
Compiling asm |
|||
Compiling parser |
|||
Compiling tokenizer |
|||
Building wad: .... 106,072 bytes added |
|||
Checking 4 items in Wad |
|||
Wad header |
|||
Protocol: 1.0 |
|||
Infomercial: zkl Wad |
|||
Time Stamp: Sun Jun 15 20:42:11 2014 |
|||
Number of objects: 4 |
|||
Data size: 106,072 bytes |
|||
Run list: 5444 |
|||
Flags: |
|||
Class Name Offset Size Run |
|||
----- ---- ------ ---- --- |
|||
Compiler.Compiler 0 28,930 5 |
|||
Compiler.Asm 28,930 15,001 4 |
|||
Compiler.Parser 43,931 55,129 4 |
|||
Compiler.Tokenizer 99,060 7,012 4 |
|||
.... |
|||
Compiled package in 2.9 seconds |
|||
zkl 1.12.11, released 2014-07-01 |
|||
zkl: ^D |
|||
$ zklIgnoreWad=1 zkl //ignore compiled in image and load just compiled one |
|||
Ignoring wad |
|||
zkl 1.12.11, released 2014-07-01 |
|||
</pre> |
|||
Since the compiler is part of the VM, you can compile from the REPL: |
|||
<pre> |
|||
zkl: Compiler.Compiler.packageFile("compiler.zkl") |
|||
Compiling asm |
|||
Compiling parser |
|||
Compiling tokenizer |
|||
... |
|||
</pre> |