Skip to content

grnt426/Compiler

Repository files navigation

== Description ==
A compiler that translates C-style code into Hartz assembly, which can then be
further compiled into a "binary executable" for a theoretical Minecraft 
CPU that is (and probably forever will be) in development. The idea is to 
support basic C-Style language constructs such as "if-else" branches, 
arithmetic, do-while loops, and function calls. The whole purpose of all this
is to gain an understanding of compilers and to specifically create a working
compiler for a highly limited machine (in both resources and instructions
available).

== Documentation ==
Author: 		Grant Kurtz
Created:		Dec 2012

The following categories breakdown into relevant sections for compilation.

	=== Hartz Instruction Set ===
	This lays out, albeit crudely, all the definitions of planned and
	currently supported hardware instructions, machine contraints, and some
	example code.

	* Hartz Instruction Set.txt

	=== Productions ===
	A list of productions that form all the language constructs that the
	C-Style compiler will break down.

	(Not Yet Added)

== Software Dependencies ==
gcc v4.3.4

== Compiling ==
make [all|hartz|ccode]

== Running ==

	=== Hartz Translator ===
	./translator (in-file) (out-file)

	=== C-Style Code Compiler ===
	./compiler

== Automated Testing ==
This section documents how to use, read, and understand the automated testing
scripts.

	=== Compiling Test Scripts ===
	make [all|test]

	=== Running Tests ===
	By defualt, this will run all tests
	./test

	=== Example Input Files ===
	These are example programs that test the translator:
		test_input/test.*

	=== Example Output Files ===
	These files are what the translator should print as file output:
		test_output/test.*

	These files are what the translator should print to stdout/err:
		test_stdout/test.*
		test_stderr/test.*
	
	=== Resulsts of Tests ===
	All test results from the last run instance of ./test are stored here:
		test_results/
	
		==== Binary Output Results ====
		test_results/test.*.b

		==== Stdout/err Results ====
		test_results/test.*.out
		test_results/test.*.err

	=== Output From Test Program ===
	The test program will make sure the environment is sane before trying, and
	then run all test input files against the executable.  Lines are compared
	individually, with any descrepencies being reported and marking the test
	as a failure.  If 50% or more of the tests fail, the summary will print
	a red asterisk, if any tests failed but less than 50% then a yellow
	asterisk is printed, and finally if no tests failed a green asterisk is
	printed at the end of all testing.

== Compilation Platform ==
Linux Version:		2.6.32-gentoo-r7
gcc (Gentoo 4.3.4 p1.1, pie-10.1.5) 4.3.4

About

A Compiler for a theoretical instruction set called Hartz for my Minecraft CPU.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages