-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
58 lines (38 loc) · 1.05 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
DATE:12/7/2016
AUTHOR:Kosuke Fujimoto
- BabyC Compiler Specification -
This file shows specification of BabyC compiler.
BabyC compiler consists following files.
- makefile
- driver.c
- lexer.lex
- parser.y
- openhash.h
- openhash.c
- ast.h
- ast.c
1. how to use
First of all, to generate execution file "bcc", you have to type command "make".
To run execution file "bcc", type ./bcc foo.bc
This program creates foo.iloc
2. Included Files
driver.c has main function that program takes command line arguments.
lexer.lex is given file. I did not change anything.
parser.y is grammer file.
openhash.c openhash.h define hash table and it holds variables with
- identifier
- value
- offset
- register number
identifier is 20 characters long. If your vairable name is longer than that, the program outputs error.
ast.c ast.h define AST and ILOC function
3. My Work
Complete Compiler Specification
declaration
Asignment
single if else
AND OR operator
Incomplete Compiler Specification
load instruction
jump instruction after first branch of if statement
while