Compilers Can Feel Like a Black Box
Compilers can feel like a black box when learning Compiler Design. Students often learn about lexical analysis, parsing, semantic analysis, and intermediate code separately, but it can be difficult to see how these stages actually work together.
For the Bharat Builds hackathon, I built Compiler Pipeline Visualizer, an educational web application that makes the compiler pipeline visible and interactive.
You might ask: “We get that, but Sahrin, wouldn't it be much nicer to explain a bit about your work?”
Well, yes! So, what I built is —
The application allows users to enter a small program and run it through an educational compiler pipeline:
Source Code → Lexer → Parser/AST → Semantic Analysis → Intermediate Representation → Execution
For example, users can enter:
let x = 10;
let y = 20;
print(x + y);
The application displays the tokens produced by lexical analysis, the resulting Abstract Syntax Tree (AST), semantic analysis results, intermediate representation, and finally the execution output.
The project also provides beginner-friendly explanations when errors occur, such as undefined variables and division by zero.
How Did AWS Help Me?
I used AWS Lambda to deploy the compiler backend. The Lambda function runs on Node.js 20.x and receives source code from the frontend through an AWS Lambda Function URL.
The frontend sends the program to Lambda using an HTTP POST request. Lambda runs the compiler pipeline and returns the results to the browser.
This allowed me to use a serverless backend without having to manage a traditional server.
Why This Project?
I am currently learning Compiler Design at university, including its different phases such as lexical analysis, parsing, semantic analysis, and intermediate code generation..
Being someone who finds visual learning helpful, this project is my attempt to make Compiler Design less abstract by allowing students to actually see what happens to a program at each stage.
From my experience while learning the subject, I also found that there seemed to be fewer interactive resources specifically focused on visualizing the different phases of a compiler. I may be wrong about this.
But I hope it helps other students understand Compiler Design a little more easily!
Loading article