Skip to content

Adm28/Compiler-in-C

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

If-Else-While-Compiler-in-C

Simulation of the front end phase of a C compiler involving the If-Else and While constructs.
This includes:

  1. Lexical Analysis- Scanning the input and formation of the symbol table.
  2. Syntactic Analysis- Creation of an Abstract Syntax Tree.
  3. Semantic Analysis- Verifying Type compatability and generating the Intermediate Code.
  4. Machine Independent Code Optimization- Constant Folding, Common Sub-Expression Elimination.

To Run Program:

  1. Place all files in the same directory.
  2. lex lexer.l
  3. yacc -d -v parser.y
    ss4) gcc y.tab.c -ll
  4. ./a.out<input.txt

Here lexer.l is the lexical analyzer, yacc -d -v parser.y runs parser.y written in YACC and -d creates y.tab.h and -v creates y.output (debugger for parser).

About

A compiler for c which is made for if-for-while constructs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published