© Copyright 2005 Peri Hankey - documentation license Gnu FDL - code license Gnu GPL - validate HTML
SourceForge.net Logo the metalanguage bootstrap

home building and testing the metalanguage compilers

The different flavours of metalanguage compiler translate rules into different representations:

home start with a clean slate

In the initial state there are a number of .lmn source files and one compiled ruleset - lmnbs.lm - the descendant of a ruleset that originally had to be constructed by hand.

 [peri@p2 lmnBootstrap]$ make clean
 rm -f *~ *.o *.lmr *.c0 *.d0 *.C *.D *.gdc *.gDc *.gcc *.gCc
 rm -f lmn2m.ac lmn2m.lm  lmn2c.lm lmn2d.lm
 rm -f lmn2m.c  lmn2c.c lmn2d.c lmn2C.c lmn2D.c
 rm -f lmn2m.d  lmn2c.d lmn2d.d lmn2C.d lmn2D.d
 rm -f lmn2C.lm lmn2C
 rm -f lmn2D.lm lmn2D
 [peri@p2 lmnBootstrap]$ ls
 lmccMain.c  lmn2cbe.lmn  lmn2dbe.lmn  lmn2mbe.lmn  lmnbs.lm  Makefile
 lmddMain.d  lmn2Cbe.lmn  lmn2Dbe.lmn  lmn2xfe.lmn  ls.txt    rub.out

home use the bootstrap to make lmn2m.lm

The first thing to do is to build a compiler that compiles rules to the textual format that can be loaded at runtime by the language machine

 [peri@p2 lmnBootstrap]$ make
 ---- make lmn rule compiler using bootstrap ruleset
 lm -r lmnbs.lm -o lmn2m.lmr -s /usr/bin/lm lmn2xfe.lmn lmn2mbe.lmn
 mv -f lmn2m.lmr lmn2m.lm
 chmod +x lmn2m.lm

home use lmn2m.lm to compile its own sources

Next we check that the compiler can compile its own sources

 ---- autocompile using bootstrapped lmn ruleset
 lm -r lmn2m.lm -o lmn2m.a1 -s /usr/bin/lm lmn2xfe.lmn lmn2mbe.lmn
 cp -f lmn2m.a1 lmn2m.ac
 mv -f lmn2m.a1 lmn2m.lm
 chmod +x lmn2m.lm

home use resulting lmn2m.lm to compile its own sources

Next we check that the autocompiled compiler can still compile its own sources.

 ---- autocompile using autocompiled ruleset
 lm -r lmn2m.lm -o lmn2m.a2 -s /usr/bin/lm lmn2xfe.lmn lmn2mbe.lmn
 mv -f lmn2m.a2 lmn2m.lm
 chmod +x lmn2m.lm

home use resulting lmn2m.lm to compile the other compilers

Initially we compile the other compilers to the internal format, sot that we can use them to compile to the wrapped and compiled forms.

 lm -r lmn2m.lm -o lmn2d.lmr -s /usr/bin/lm lmn2xfe.lmn lmn2dbe.lmn
 mv -f lmn2d.lmr lmn2d.lm; chmod +x lmn2d.lm
 lm -r lmn2m.lm -o lmn2D.lmr -s /usr/bin/lm lmn2xfe.lmn lmn2Dbe.lmn
 mv -f lmn2D.lmr lmn2D.lm; chmod +x lmn2D.lm
 lm -r lmn2m.lm -o lmn2c.lmr -s /usr/bin/lm lmn2xfe.lmn lmn2cbe.lmn
 mv -f lmn2c.lmr lmn2c.lm; chmod +x lmn2c.lm
 lm -r lmn2m.lm -o lmn2C.lmr -s /usr/bin/lm lmn2xfe.lmn lmn2Cbe.lmn
 mv -f lmn2C.lmr lmn2C.lm; chmod +x lmn2C.lm

home build and test compiled versions

 lm -r lmn2d.lm  -o lmn2m.d  lmn2xfe.lmn lmn2mbe.lmn
 /opt/gdc/bin/gdc -o lmn2m.gdc -I/usr/include -finline-functions -O3  lmn2m.d lmddMain.d -ldl /usr/lib/liblm -Wl,-rpath,/usr/lib/
 ./lmn2m.gdc -o lmn2m.d0 -s /usr/bin/lm lmn2xfe.lmn lmn2mbe.lmn
 diff lmn2m.d0 lmn2m.lm
 lm -r lmn2d.lm  -o lmn2d.d lmn2xfe.lmn lmn2dbe.lmn
 /opt/gdc/bin/gdc -o lmn2d.gdc -I/usr/include -finline-functions -O3  lmn2d.d lmddMain.d -ldl /usr/lib/liblm -Wl,-rpath,/usr/lib/
 ./lmn2d.gdc -o lmn2d.d0 lmn2xfe.lmn lmn2dbe.lmn
 diff lmn2d.d0 lmn2d.d
 lm -r lmn2d.lm  -o lmn2D.d lmn2xfe.lmn lmn2Dbe.lmn
 /opt/gdc/bin/gdc -o lmn2D.gdc -I/usr/include -finline-functions -O3  lmn2D.d lmddMain.d -ldl /usr/lib/liblm -Wl,-rpath,/usr/lib/
 lm -r lmn2D.lm -o lmn2D.d lmn2xfe.lmn lmn2Dbe.lmn
 ./lmn2D.gdc -o lmn2D.d0 lmn2xfe.lmn lmn2Dbe.lmn
 diff lmn2D.d0 lmn2D.d
 lm -r lmn2d.lm  -o lmn2c.d  lmn2xfe.lmn lmn2cbe.lmn
 /opt/gdc/bin/gdc -o lmn2c.gdc -I/usr/include -finline-functions -O3  lmn2c.d lmddMain.d -ldl /usr/lib/liblm -Wl,-rpath,/usr/lib/
 ./lmn2d.gdc -o lmn2c.d0 lmn2xfe.lmn lmn2cbe.lmn
 diff lmn2c.d0 lmn2c.d
 lm -r lmn2d.lm  -o lmn2C.d lmn2xfe.lmn lmn2Cbe.lmn
 /opt/gdc/bin/gdc -o lmn2C.gdc -I/usr/include -finline-functions -O3  lmn2C.d lmddMain.d -ldl /usr/lib/liblm -Wl,-rpath,/usr/lib/
 ./lmn2d.gdc -o lmn2C.d0 lmn2xfe.lmn lmn2Cbe.lmn
 diff lmn2C.d0 lmn2C.d
 lm -r lmn2c.lm  -o lmn2m.c lmn2xfe.lmn lmn2mbe.lmn
 gcc -o lmn2m.gcc  lmn2m.c lmccMain.c -ldl /usr/lib/liblm -Wl,-rpath,/usr/lib/ -L/opt/gdc/lib/ -lgphobos -lm -lpthread -lc
 ./lmn2m.gcc -o lmn2m.c0 -s /usr/bin/lm lmn2xfe.lmn lmn2mbe.lmn
 diff lmn2m.c0 lmn2m.lm
 lm -r lmn2c.lm  -o lmn2d.c  lmn2xfe.lmn lmn2dbe.lmn
 gcc -o lmn2d.gcc  lmn2d.c lmccMain.c -ldl /usr/lib/liblm -Wl,-rpath,/usr/lib/ -L/opt/gdc/lib/ -lgphobos -lm -lpthread -lc
 ./lmn2d.gcc -o lmn2d.c0 lmn2xfe.lmn lmn2dbe.lmn
 diff lmn2d.c0 lmn2d.d
 lm -r lmn2c.lm  -o lmn2D.c  lmn2xfe.lmn lmn2Dbe.lmn
 gcc -o lmn2D.gcc  lmn2D.c lmccMain.c -ldl /usr/lib/liblm -Wl,-rpath,/usr/lib/ -L/opt/gdc/lib/ -lgphobos -lm -lpthread -lc
 ./lmn2D.gcc -o lmn2D.c0 lmn2xfe.lmn lmn2Dbe.lmn
 diff lmn2D.c0 lmn2D.d
 lm -r lmn2c.lm  -o lmn2c.c  lmn2xfe.lmn lmn2cbe.lmn
 gcc -o lmn2c.gcc  lmn2c.c lmccMain.c -ldl /usr/lib/liblm -Wl,-rpath,/usr/lib/ -L/opt/gdc/lib/ -lgphobos -lm -lpthread -lc
 ./lmn2c.gcc -o lmn2c.c0 lmn2xfe.lmn lmn2cbe.lmn
 diff lmn2c.c0 lmn2c.c
 lm -r lmn2c.lm  -o lmn2C.c  lmn2xfe.lmn lmn2Cbe.lmn
 gcc -o lmn2C.gcc  lmn2C.c lmccMain.c -ldl /usr/lib/liblm -Wl,-rpath,/usr/lib/ -L/opt/gdc/lib/ -lgphobos -lm -lpthread -lc
 lm -r lmn2C.lm -o lmn2C.c lmn2xfe.lmn lmn2Cbe.lmn
 ./lmn2C.gcc -o lmn2C.c0 lmn2xfe.lmn lmn2Cbe.lmn
 diff lmn2C.c0 lmn2C.c

home done