A comprehensive collection of laboratory experiments for System Programming and Compiler Construction, covering language processors, assemblers, macro processors, linkers, loaders, and compiler design tools.
How to Use · Learning Path · Experiment 1 · Experiment 2 · Experiment 3 · Experiment 4 · Experiment 5 · Experiment 6 · Experiment 7 · Experiment 8 · Experiment 9 · Experiment 10
Tip
LEX & YACC Workflow: When working with LEX/YACC tools, always test your regular expressions and grammar rules incrementally. Start with the simplest patterns first, then gradually add complexity. For Assembler experiments, ensure your Symbol Table (SYMTAB) from Pass-I is correctly populated before attempting Pass-II, as all address resolution depends on it.
Warning
Compilation Requirements: When compiling LEX files, always ensure the -lfl library is linked or define yywrap() to avoid linker errors. For Assembler experiments (Pass-I/II), verify that INPUT.txt and OPTAB.txt are in the same directory as the executable.
- Navigate to the desired experiment folder.
- Open the
.cfile. - Compile using:
gcc filename.c -o output - Run using:
./output
Example:
cd "Experiment-1/Source Code"
gcc DFA_Implementation.c -o DFA
./DFA- Navigate to the experiment folder.
- Generate C code:
flex filename.l - Compile with library:
gcc lex.yy.c -o scanner -lfl - Run using:
./scanner
Example:
cd "Experiment-2/Source Code"
flex Lex_Lexical_Analyzer.l
gcc lex.yy.c -o lexer -lfl
./lexerBeginner Level:
- Start with Experiment 1 to understand DFA implementation and Symbol Table concepts.
- Practice Experiment 2 for both automated (LEX) and manual lexical analysis approaches.
Intermediate Level:
- Explore Experiments 3 & 4 to master parsing techniques (FIRST/FOLLOW sets, Recursive Descent Parsing).
- Study Experiments 5 & 6 for code optimization and target code generation strategies.
Advanced Level:
- Dive into Experiments 7 & 8 for comprehensive two-pass assembler design (Symbol Table generation and Object Code synthesis).
- Master Experiments 9 & 10 for Macro Processing and advanced LEX/YACC tool usage.
Implementation of Symbol Table using C to manage identifiers and their properties.
Date: February 05, 2021
| # | Program | Description | Source Code |
|---|---|---|---|
| 1 | DFA_Implementation.c | C implementation for DFA acceptance | View |
| — | Lab Report | Detailed experiment report | View |
Scanner development using LEX tool to identify tokens in a source program.
Date: February 26, 2021
| # | Program | Description | Source Code |
|---|---|---|---|
| 1 | Lex_Lexical_Analyzer.l | LEX implementation for scanner | View |
| 2 | Manual_Lexical_Analyzer.c | Manual C implementation for scanner | View |
| 3 | sample_input.c | Test C file for analysis | View |
| — | Lab Report | Detailed experiment report | View |
Implementation of FIRST and FOLLOW sets calculation for syntax analysis of grammars.
Date: March 05, 2021
| # | Program | Description | Source Code |
|---|---|---|---|
| 1 | First_Follow_Implementation.c | C implementation for FIRST & FOLLOW | View |
| 2 | grammar.txt | Input grammar for calculation | View |
| — | Lab Report | Detailed experiment report | View |
Implementation of Recursive Descent Parser for syntax analysis of grammars.
Date: March 26, 2021
| # | Program | Description | Source Code |
|---|---|---|---|
| 1 | RD_Parser_Implementation.c | C implementation for RD Parser | View |
| — | Lab Report | Detailed experiment report | View |
Implementation of constant folding and common sub-expression elimination techniques.
Date: March 30, 2021
| # | Program | Description | Source Code |
|---|---|---|---|
| 1 | Code_Optimization.c | C implementation for optimizations | View |
| — | Lab Report | Detailed experiment report | View |
Implementation of Target Code Generation logic including MOV and arithmetic instructions.
Date: April 09, 2021
| # | Program | Description | Source Code |
|---|---|---|---|
| 1 | Target_Code_Generator.c | C implementation for Target Code Generation | View |
| — | Lab Report | Detailed experiment report | View |
Design and implementation of Pass-I Assembler to generate Symbol Table and calculate program length.
Date: April 30, 2021
| # | Program | Description | Source Code |
|---|---|---|---|
| 1 | Assembler_Pass1.c | C implementation for Assembler PASS-I | View |
| 2 | INPUT.txt | Input assembly source code | View |
| 3 | OPTAB.txt | Machine Operation Table | View |
| 4 | SYMTAB.txt | Generated Symbol Table | View |
| — | Lab Report | Detailed experiment report | View |
Design and implementation of Pass-II Assembler to generate Object Code (H, T, E records).
Date: April 30, 2021
| # | Program | Description | Source Code |
|---|---|---|---|
| 1 | Assembler_Pass2.c | C implementation for Assembler PASS-II | View |
| — | Lab Report | Detailed experiment report | View |
Simulation of a one-pass Macro Processor handling definition and expansion.
Date: May 07, 2021
| # | Program | Description | Source Code |
|---|---|---|---|
| 1 | Macro_Processor.c | C implementation for Macro Processor | View |
| — | Lab Report | Detailed experiment report | View |
Parser development using YACC tool for various grammatical structures.
Date: May 07, 2021
| # | Program | Description | Source Code |
|---|---|---|---|
| 1 | Integer_Recognizer.l | LEX script to recognize integers | View |
| 2 | Arithmetic_Counter.l | LEX script to count numbers | View |
| — | Lab Report | Detailed experiment report | View |
How to Use · Learning Path · Experiment 1 · Experiment 2 · Experiment 3 · Experiment 4 · Experiment 5 · Experiment 6 · Experiment 7 · Experiment 8 · Experiment 9 · Experiment 10
CSL602 · Semester VI · Computer Engineering
University of Mumbai · Curated by Amey Thakur