Skip to content

Commit

Permalink
Checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesaorson committed Sep 27, 2022
1 parent 2f426d5 commit 0145afd
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 20 deletions.
Binary file modified bootstrap/linux/daybreak
Binary file not shown.
15 changes: 2 additions & 13 deletions src/include/parser/ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,10 @@ union TypeExpressionNodeUnion {
/* Type Definitions */
/********************/

struct AstNode {
typedef struct AstNode {
AstNodeKind kind;
union AstNodeUnion value;
};
} AstNode;

struct BindingStatementNode {
AstNodeKind kind;
Expand Down Expand Up @@ -490,7 +490,6 @@ struct UnionTypeDeclarationNode {
/* Function Declarations */
/*************************/

struct AstNode* ast_new_node(AstNodeKind, union AstNodeUnion);
void ast_free_node(struct AstNode*);

struct BindingStatementNode* ast_new_binding_statement_node(AstNodeKind, union BindingStatementNodeUnion);
Expand Down Expand Up @@ -724,16 +723,6 @@ bool ast_union_type_declaration_token_matches_first_set(struct Token);
/***********/
/* AstNode */
/***********/
struct AstNode* ast_new_node(
AstNodeKind kind,
union AstNodeUnion value
) {
struct AstNode* node = malloc(sizeof(struct AstNode));
node->kind = kind;
node->value = value;
return node;
}

void ast_free_node(struct AstNode* node) {
switch (node->kind) {
case AstBindingStatement: {
Expand Down
2 changes: 1 addition & 1 deletion src/include/std/log/ansi_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <std/ansi/colors.h>

#ifndef DEBUG
#define DEBUG false
#define DEBUG true
#endif

#if DEBUG
Expand Down
1 change: 1 addition & 0 deletions src/main.day
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import "std/log/prelude.day"
import "std/compiler/api.day"
import "std/compiler/parser.day"

fun main (argc: int argv: ptr<ccstring>) int do
(daybreak_greeting)
Expand Down
1 change: 1 addition & 0 deletions std/compiler/parser.day
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "std/compiler/parser/prelude.day"
1 change: 0 additions & 1 deletion std/compiler/parser/ast.day
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
import "std/compiler/parser/types.day"
import "std/compiler/parser/ast/prelude.day"
11 changes: 9 additions & 2 deletions std/compiler/parser/ast/ast_node.day
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
type AstNodeUnion union is

end

fun ast_new_node (kind: AstNodeKind value: AstNodeUnion) ptr<AstNode> do
mut node: ptr<AstNode> <- (malloc
(mul (sizeof AstNode)))
mut node: ptr<AstNode> <- new {AstNode
kind <- kind
value <- value
}
node
end
2 changes: 1 addition & 1 deletion std/compiler/parser/ast/prelude.day
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import "compiler/parser/ast/ast_node.day"
import "std/compiler/parser/ast/ast_node.day"
3 changes: 1 addition & 2 deletions std/compiler/parser/prelude.day
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import "std/compiler/parser/ast.day"
import "std/compiler/parser/types.day"

importc "compiler/parser/prelude.h"
importc "parser/prelude.h"
Empty file removed std/compiler/parser/types.day
Empty file.

0 comments on commit 0145afd

Please sign in to comment.