Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

11 Commits

Repository files navigation

CD_LAB — Compiler Design Lab Collection

This repository contains a comprehensive collection of compiler design laboratory programs organized by cycles. Each program demonstrates key concepts in compiler construction, from lexical analysis to code generation.

Program Directory

CycleProgramPathDescription
Cycle 1p1Cycle1/p1Epsilon Closure Calculator - Computes ε-closure for finite automaton states
Cycle 1p2Cycle1/p2ε-NFA to NFA Converter - Converts ε-NFA to equivalent NFA
Cycle 1p3Cycle1/p3NFA to DFA Converter - Implements subset construction algorithm
Cycle 1p4Cycle1/p4DFA Minimization - Minimizes DFA using partition refinement
Cycle 2p5Cycle2/p5Lexical Analyzer in C - Hand-written scanner implementation
Cycle 2p6Cycle2/p6Name Substring Scanner - Flex-based pattern matching
Cycle 2p7Cycle2/p7Identifier Validator - Lex/Yacc based identifier syntax checker
Cycle 2p8Cycle2/p8Arithmetic Expression Calculator - Lex/Yacc expression evaluator
Cycle 2p9Cycle2/p9Intermediate Code Generator - Generates quadruples for C-like code
Cycle 2p10Cycle2/p10FOR Loop Validator - Syntax checker for C-style FOR loops
Cycle 3p11Cycle3/p11Operator Precedence Parser - Parses expressions using precedence relations
Cycle 3p12Cycle3/p12FIRST/FOLLOW Calculator - Computes FIRST and FOLLOW sets for CFGs
Cycle 3p13Cycle3/p13Recursive Descent Parsers - Top-down parsing implementations
Cycle 3p14Cycle3/p14Shift-Reduce Parser - Bottom-up parsing for arithmetic expressions
Cycle 4p15Cycle4/p15Three-Address Code Generator - Generates TAC for expressions
Cycle 4p16Cycle4/p16Target Code Generator - Converts intermediate code to assembly

Cycle Overview

  1. Cycle 1: Focuses on finite automata theory and conversions
  2. Cycle 2: Covers lexical analysis and basic parsing using Lex/Yacc
  3. Cycle 3: Implements various parsing techniques and grammar analysis
  4. Cycle 4: Addresses code generation and optimization

Building and Running

Most programs can be built using gcc. For Lex/Yacc programs:

  1. Generate scanner: flex file.l
  2. Generate parser: bison -d file.y
  3. Compile: gcc lex.yy.c y.tab.c -o program

See individual program READMEs for specific build and run instructions.

For detailed explanations, example inputs, and code walkthrough of any program, check its corresponding README file linked in the table above.

About

S7 Compiler Design Lab

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages