My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
Compiler  
Compiles Kitsch code into an intermediate assembly-like language.
Updated Jan 8, 2009 by apangb...@gmail.com

Setting Up

Details on downloading Kitsch and compiling the Compiler are available here.

Using the Compiler

After the compiler has been built, it resides in the projects /bin folder

Usage: java Compiler infile [outfile]

An input file must be specified for the compiler. The output file name is optional. If an output filename is not provided, it defaults to the infile with a ".ko" extension in the current directory.

The compiler depends on other classes in the bin folder, therefore it must either be run from the /bin folder, or you must include it as part of Java's class path

kitsch/bin $ java Compiler testFile.k
kitsch $ java -classpath bin Compiler someFile.k

Compiler Design

The Compiler source code is available here. The design follows the standard Visitor pattern; pj2, which generates the parser for the language, is also kind enough to generate tree node classes and implement a visit() method for each of them.

Rather than targeting an actual hardware platform - such as X86, or an existing virtual machine such as Sun Java's byte code or Microsoft's Common Language Runtime - Kitsch targets it's own simple 0-address (stack-based) assembly-like machine language. More details on target machine language can be found here.

A virtual machine interprets the machine language. Details about the virtual machine can be found here.

Powered by Google Project Hosting