-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add missing headers, fix gitignore, rm c-only test framework
- Loading branch information
1 parent
24a44fb
commit 93be8bc
Showing
11 changed files
with
65 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
holyc | ||
**/*.o | ||
*.o | ||
*.a | ||
test/bin/ |
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,16 @@ | ||
#ifndef HOLYC__PARSE | ||
#define HOLYC__PARSE | ||
|
||
#include <holyc/ast.h> | ||
#include <holyc/lex.h> | ||
|
||
typedef struct Parser { | ||
NodeNameTable node_name_table; | ||
Lexer lexer; | ||
} Parser; | ||
|
||
Parser *parse_new(Parser *parser, char *input, int size); | ||
AstNode *parse_parse(Parser *parser); | ||
void parse_print_node(Parser *parser, AstNode *node); | ||
|
||
#endif // HOLYC__PARSE |
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,36 @@ | ||
#ifndef HOLYC_AST | ||
#define HOLYC_AST | ||
|
||
typedef enum { | ||
NODE_UNINITIALIZED, | ||
NODE_INT, | ||
NODE_BINOP_PLUS, | ||
NODE_BINOP_MIN, | ||
NODE_BINOP_MUL, | ||
NODE_BINOP_DIV, | ||
NODE_EXPR, | ||
} AstType; | ||
|
||
#define NUM_NODES 7 | ||
|
||
typedef char *NodeNameTable[NUM_NODES]; | ||
|
||
typedef struct AstNode { | ||
AstType type; | ||
int value; | ||
|
||
struct AstNode *left; | ||
struct AstNode *right; | ||
|
||
struct AstNode *expr_value; | ||
} AstNode; | ||
|
||
// typedef struct BinOpNode { | ||
// AstNode left; | ||
// AstNode right; | ||
// BinOpType type; | ||
// } BinOpNode; | ||
|
||
AstNode *ast_new(AstNode *node, AstType type, int value); | ||
|
||
#endif // HOLYC_AST |
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,10 @@ | ||
#ifndef HOLYC_BUFFER | ||
#define HOLYC_BUFFER | ||
|
||
typedef struct Buffer { | ||
char *start; | ||
char *curr; | ||
int size; | ||
} Buffer; | ||
|
||
#endif // HOLYC_BUFFER |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.