Skip to content

A mini compiler for a subset of the C programming language.

Notifications You must be signed in to change notification settings

eeshwarg/C-compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C-compiler

This is the frontend of a compiler for a subset of C. The stages of the compiler implemented are lexical, syntax, semantic phases and intermediate code generation. It includes support for the datatypes int and char. Conditional statements that are supported are if-else. Support is also provided for the while iteration statement. All the basic error checking for each of the three phases is implemented.

Getting started

The tools used for building this compiler are flex for the lexical phase and yacc for the remaining phases.

Installing

The tools can be installed with the commands

  sudo apt-get install flex yacc

Using the compiler

Navigate to the root directory of the repository. To run the compiler on a source program, say test.c, run the following command:

./compile test.c

The output is a sequence of three address instructions equivalent to the input C program.

About

A mini compiler for a subset of the C programming language.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •