Skip to content

KosukeFujimoto/BabyC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 

About

CSC151 Assignment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published