Skip to content
This repository has been archived by the owner on Feb 14, 2022. It is now read-only.

Commit

Permalink
Separating out a header for assembly.c.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wilfred committed Jul 28, 2014
1 parent 12f3cb1 commit eba0c8a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -21,7 +21,7 @@ syntax.o: syntax.c
.INTERMEDIATE: y.tab.c lex.yy.c stack.o assembly.o syntax.o

babyc: lex.yy.c y.tab.c syntax.o assembly.o stack.o
$(CC) $(CFLAGS) lex.yy.c y.tab.c syntax.o stack.o -o babyc
$(CC) $(CFLAGS) $^ -o babyc

.PHONY: clean
clean:
Expand Down
19 changes: 19 additions & 0 deletions assembly.h
@@ -0,0 +1,19 @@
#include <stdio.h>
#include "syntax.h"

#ifndef BABYC_ASSEMBLY_HEADER
#define BABYC_ASSEMBLY_HEADER

void emit_header(FILE *out, char *name);

void emit_insn(FILE *out, char *insn);

void write_header(FILE *out);

void write_footer(FILE *out);

void write_syntax(FILE *out, Syntax *syntax);

void write_assembly(Syntax *syntax);

#endif
2 changes: 1 addition & 1 deletion babyc_parse.y
@@ -1,7 +1,7 @@
%{
#include <stdio.h>
#include "syntax.h"
#include "assembly.c"
#include "assembly.h"
#include "stack.h"

int yyparse(void);
Expand Down

0 comments on commit eba0c8a

Please sign in to comment.