Skip to content

Lexical Analyzer, YACC files & regular grammars to recognize statements used in a program

License

Notifications You must be signed in to change notification settings

Priyanshu1035/compiler_design

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Compiler_Design

Overview

This repository contains the source code of the programs done in our lab using Lex and Yacc.
Lexical analysers (.l) files are used to recognise the tokens encountered in a program.
Yacc (.y) files are used to design custom grammars for one's own compiler.

Features

Lexical analysis using Lex
Syntactic analysis and parsing using Yacc
c files & txt files for code input
There are a lot of garbage files which are a result of .y & .l file evaluation

Usage

It's better to work on a UNIX based OS (Ubuntu / Redhat / CentOS)
Make sure you have Flex (Lex) & Bison (YACC) installed on your system

How to run lex files (.l files)

Run the following commands in order

lex <file_name.l>
gcc lex.yy.c -ll -o <custom_file_name>
./<custom_file_name> < input_file > output_file

How to run yacc files (.y files)

Run the following commands in order

yacc -dv <file_name.y>
gcc y.tab.c -ll -o <custom_file_name>
./<custom_file_name> < input_file > output_file

Feel free to submit a PR if you come across any issues.

About

Lexical Analyzer, YACC files & regular grammars to recognize statements used in a program

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 88.0%
  • SWIG 4.7%
  • Lex 3.3%
  • Assembly 1.5%
  • eC 1.3%
  • Yacc 1.2%