comcom.h is header file , and it contains main() func. t0.def is the definition of THIS Compiler Compiler. t3.out.c is the C source code of THIS Compiler Compiler.
$ gcc t3.out.c $ ./a.out t0.def t4.out.cthen, t4.out.c is generated. t4.out.c is exactly same as t3.out.c .
a.out generated from t3.out.c is a Compiler Compier. So, you can use this a.out as a yacc/bison.
One of the souce code of the a.out is t0.def. t0.def is the definition of the self extendable compiler compiler. So, the a.out can generate the same source code of a.out by using t0.def .1. t0.def is the definition of the self extendable compiler compiler. 2. The executable code from the t0.def is a.out. 3. a.out is a compiler compiler like a yacc/bison. 4. a.out can generate a C source code by using t0.def. 5. And that C code is the source code of a.out !! 6. You can design a new Compiler by using a.out.
"THIS IS A PEN Analyzer" can analyze a text file contains "THIS IS A PEN" text string or not.
The definition of this analyzer is sample.def.
START(SAMPLE) SAMPLE : THIS IS "A" PEN { call(1); call(2); call(3); print("finish!"); } ; THIS : "THIS" { print("-this-"); } | "THAT" { print("-that-"); } ; IS : "IS" { print("-is-");} | "ARE" { print("-are-");} ; PEN : "PEN" { print("-pen-");} | "PENCIL" { print("-pencil-");} ; END
$ ./a.out sample.def sample.c $ gcc -o sample sample.c
Now, you should make a definition file .
$ cat user.txt THIS IS A PENCIL $ ./sample user.txt user.out $ cat user.out -this--is--pen-finish!
Enjoy.