Ebo Compiler
The Ebo compiler can be any
compiler for which translation tables (an Ebo Map) exist.
This demo uses a modified
lcc compiler developed by Christopher W. Fraser, David R. Hanson, and
Jacob Navia (Please see the readme file that comes with the download).
The lcc compiler is a Windows 95/98 C compiler. The lcc compiler has been
modified to read an Ebo file, translate it into an compilable source file,
and compile that source file. A linker and resource compiler is also included
so that an application can be created and run.
Ebo Map
The files used to map the
symbols in the Ebo file to the keywords of the Windows and C are contained
in the C:\zbo\bin\EboMap. There are six files.
- cEbo.txt contains the mappings
(two symbols) for standard C procedure and constant names.
- hdrEbo.txt contains the
mappings (one symbol) for the standard C header filenames.
- keyEbo.txt contains the
mappings (one symbol) for standard C keywords.
- lccEbo.txt contains the
mappings (one symbol) for lcc compiler specific keywords.
- winEbo.txt contains the
mappings (two symbols) for Windows API
- resEbo.txt contains words
which are not converted to the symbol format.
Speed
Compilation speed is fast
because the compiler does not have to read as many characters as in the
uncompressed source file. But the compiler is not as fast as it could
be because of two things:
- All of the translation
tables have to be read from the EboMap translation files at the beginning
of the program.
- The modified lcc compiler
does not directly compile the Ebo file, but it reads the Ebo file, converts
its symbols into keywords and writes the result to disk (in C:\zbo\bin\EboTemp).
It is this temporary file
which is actually compiled. This overhead slows down the compilation time.
In future versions, the lexer and preprocessor will be rewritten to directly
compile an Ebo file. Note: I actually did try to rewrite the lexer and
the preprocessor to directly compile the Ebo file, but rewriting the preprocessor
in the time frame in which I had was not possible (Now I wish I had taken
that compiler class).
Future Enhancements
Translating the file before
compilations serves my purpose for demonstrating the system. Further modifications
to the compiler can result in more reductions in the Ebo file size.
One example is the translation
tables for the Windows API. I assigned two character codes to every procedure,
constant, structure, and element within the structures. Keeping all symbols
the same length made the translation algorithm really easy and fast. But
due to scoping, I could have made all elements within structures one character.
The compiler would then have to be modified to recognized an element being
referenced. This is possible because I do something similar in expressor
when I'm converting user defined structures into symbols. This technique
uses scoping to define the minimum number of symbols possible.
Also certain characters used
in standard C can be eliminated. These characters help make the program
readable by humans but are not necessarily needed by a modified compiler.
One example would be the opening
parenthesis for procedures. The modified compiler knows if a symbol represents
a procedure because the symbol lies within a certain range. Once the compiler
reads the symbol representing a procedure; it knows it has a procedure
and can go on processing arguments. There are probably many other ways
the compiler can be improved.
Another modification in the
compiler would be security features in which the compiler would prompt
the user if the source file contains any commands which may be bad for
the client's machine such as write or read commands to disks or execution
of system commands. This feature would be necessary when the compiler
is converted into a browser plug-in.
Execution
Currently, execution of an
Ebo program is a manual process. The Ebo source file and a corresponding
.bat file are downloaded from the web and placed in the bin folder. The
user must double-click on the .bat file and execute it.
The .bat file does three things:
1. Launch lcc to compile the
source file with the optimize flag turned on.
2. Link the object files
3. Launch the resulting executable.
In the future, I envision
making the compiler a Browser plug-in. The plug-in would automatically
download the Ebo file, recognize the language it represents, compile it
with the appropriate compiler, and run the program in an appropriate window.
|