Skip to content

This repository contains lab programs developed for the Compiler Design and System Software (CDSS) course. It includes practical implementations using Lex and Yacc for lexical analysis and parsing, as well as C programs that demonstrate key concepts in compiler design and system software.

Notifications You must be signed in to change notification settings

shreeramdrao/Lex-Yacc-Programming-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

INCS Lab Programs

This repository contains the lab programs for the Compiler Design and System Software (CDSS) subject. The programs include implementations using Lex, Yacc, and C language. These are the practical exercises covered during the Compiler Design Lab sessions.

Contents

  • Lex Programs: Programs written in Lex for lexical analysis.
  • Yacc Programs: Programs that use Yacc for parsing, along with Lex for lexical analysis.
  • C Programs: Various C programs related to Compiler Design concepts.

Directory Structure

The repository is organized as follows:

/lex/ lex_program1.l lex_program2.l … /yacc/ yacc_program1.y yacc_program2.y … /c/ program1.c program2.c …

Each directory contains the respective source files:

  • /lex/: Contains Lex source files (.l).
  • /yacc/: Contains Yacc source files (.y) and associated Lex files.
  • /c/: Contains C programs.

How to Compile and Run

Lex Programs

  1. Navigate to the lex/ directory:

    cd lex
  2. Compile the Lex program:

    lex lex_program1.l
    gcc lex.yy.c -o lex_program1
  3. Run the Lex program:

    ./lex_program1

Yacc Programs

  1. Navigate to the yacc/ directory:

    cd yacc
  2. Compile the Yacc program along with its Lex file:

    yacc -d yacc_program1.y
    lex lex_file.l
    gcc y.tab.c lex.yy.c -o yacc_program1
  3. Run the Yacc program:

    ./yacc_program1

C Programs

  1. Navigate to the c/ directory:

    cd c
  2. Compile the C program:

    gcc program1.c -o program1
  3. Run the C program:

    ./program1

Requirements

  • Lex: A tool for generating lexical analyzers.
  • Yacc: A tool for generating parsers.
  • GCC: A compiler for C language.

Make sure these tools are installed on your system to compile and run the programs.

Contributing

Contributions to this repository are welcome. Feel free to fork this repository, make changes, and submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

This repository contains lab programs developed for the Compiler Design and System Software (CDSS) course. It includes practical implementations using Lex and Yacc for lexical analysis and parsing, as well as C programs that demonstrate key concepts in compiler design and system software.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published