Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
1,047 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,25 @@ | ||
CFLAGS=-std=c99 | ||
# Used for compiling the project. If no make target is specified, by default | ||
# only the object files necessary to create the Hartz translator are compiled. | ||
CC = gcc | ||
CFLAGS = -std=c99 -Wall -lm | ||
COMMON_FILES = symbols.c idents.c strlib.c generrors.c terms.c | ||
HARTZ_FILES = translator.c | ||
CCODE_FILES = compiler.c | ||
HARTZ_EXEC = translator | ||
CCODE_EXEC = compiler | ||
|
||
all: hartz | ||
|
||
hartz: | ||
gcc $(CFLAGS) translator.c symbols.c idents.c strlib.c generrors.c -o translator | ||
all: hartz ccode | ||
|
||
ccode: | ||
gcc $(CLFAGS) compiler.c symbols.c idents.c strlib.c generrors.c -o compiler | ||
# To translate Hartz assembly into a "binary executable" | ||
hartz: $(HARTZ_FILES) $(COMMON_FILES) | ||
$(CC) $(CFLAGS) -o $(HARTZ_EXEC) $(HARTZ_FILES) $(COMMON_FILES) | ||
|
||
# To compile C-Style code into Hartz Assembly | ||
ccode: $(CCODE_FILES) $(COMMON_FILES) | ||
$(CC) $(CFLAGS) -o $(CCODE_EXEC) $(CCODE_FILES) $(COMMON_FILES) | ||
|
||
# Just cleans up object files, which aren't needed after the linker creates | ||
# the executable | ||
clean: | ||
rm -rf *.o hartz ccode | ||
rm -f *.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,47 @@ | ||
Will be updated later... | ||
== 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 | ||
|
||
== Compilation Platform == | ||
Linux Version: 2.6.32-gentoo-r7 | ||
gcc (Gentoo 4.3.4 p1.1, pie-10.1.5) 4.3.4 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.