This repository has been archived by the owner on Jun 28, 2024. It is now read-only.
generated from dthain/compilerbook-starter-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Modify typechecker test cases to cover return type error * Improve a boolean expression * Add support for function rtype and prototype checking * Condense Makefile * Create scratch.c and scratch.h * Create label.c and label.h * Create codegen.c and codegen.h * Protect type_print() from null pointer * Implement decl_codegen() * Implement symbol_codegen() * Implement stmt_codegen() * Implement expr_codegen() * Format library.c * Add --codegen option in bminor.c * Add codegen_test * Create codegen test cases
- Loading branch information
Showing
43 changed files
with
917 additions
and
48 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
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include <stdio.h> | ||
#include "typechecker.h" | ||
#include "codegen.h" | ||
|
||
int codegen_errors = 0; | ||
|
||
int codegen(struct decl* d) | ||
{ | ||
int type_errors = typecheck(d); // name resolution and type checking | ||
if (type_errors) | ||
{ | ||
fprintf(stderr, "CodeGen Error | Type errors occurred, aborting code generation\n"); | ||
return type_errors; | ||
} | ||
|
||
decl_codegen(d); | ||
return codegen_errors; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#ifndef CODEGEN_H | ||
#define CODEGEN_H | ||
|
||
#include "decl.h" | ||
|
||
/** @return number of errors */ | ||
int codegen(struct decl* d); | ||
|
||
#endif //CODEGEN_H |
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.