Home
Bookstore
Comp Sci
Psychology
Resume
About
Free Style
Links
QLogo

QLogo is a set of programs containig:

  • a Logo optimizing compiler
  • a virtual machine for the execution of the binary code generated by the compiler
  • a dessassembler for the vizualization of the binary code
  • a graphic interface used for the turtle-graphics characteristic of Logo

The source language accepted by the compiler is a variant of Logo. It allows functions and procedures declaration, local and global variables, and herogenous lists.The atomic data types are integer, float, char and string. The compiler does type-inference and implicit variables declarations.

The compiler is very quick: the compilation is done in "one pass", using back-patching and hashing. Some optimizations are also performed: dead-code elimination, common subexpression optimization (DAG evaluation), boolean  expressions and register allocation optimization, and more. The boolean expresions are evaluated by control flow (short-cut evaluation), with the almost minimum number of generated JMPs. The subroutine activation and return sequences are also very small and quick, using a special technique, 'register copying'. This way, the generated target code ('binary code') is amaizingly small.
The compiler aslo features: international support (the source code can be in english, french and spanish :) and the famous Logo turtle graphics.

The virtual machine (vm) was also conceived to be quick. The typical execution speed on my Pentium200 is 4VMIPS (four millions virtual-machine instructions per second). The vm is a RISC, with the exception of some rather complex graphic instructions.

The dessasembler is used to admire the beauty and perfection of the generated code :)

The graphic interface is a Motif application for XWindows, which plays the role of a graphic server for the virtual machine. The communication between the vm and the interface is done via Unix named pipes (FIFOs). This way, the graphic output of a program can be displayed (vith the gr interface running), or recorded to a file for permanent storage. Anyway, this is also a bottle-neck for graphics intensive code.

I wrote QLogo as a project for the 'Compilers' course, in 1998. I worked on it for about three weeks, and I really enjoyed. It's written in C, for Linux, using Lex and Yacc. Also tested on Sun Solaris and HPUX.

Download: the source code

Soon, you'll find here sample programs and screen-shots.

Click here for Mihai Preda's Homepage
BookstoreHomeComputer SciencePsychologyResumeAboutFree StyleFavorite Links

Update 29 Apr, 1999
E-mail me