Static Code Analyzer is a web-based application developed using Python and Flask that analyzes C-like source code without executing it. The system performs Lexical Analysis, Syntax Analysis, and Semantic Analysis to identify programming errors at different stages of compilation.
The main objective of this project is to help students understand how compiler phases work internally and how errors can be detected before program execution.
- Tokenization of source code using a custom Lexer
- Detection of keywords, identifiers, literals, operators, and symbols
- Syntax error detection
- Missing semicolon detection
- Invalid declaration detection
- Invalid assignment detection
- Semantic error detection
- Undeclared variable checking
- Type mismatch checking
- User-friendly web interface using Flask
- Real-time analysis without code execution
- Python
- Flask
- HTML
- CSS
- Regular Expressions (Regex)
- User enters C-like source code in the web interface.
- The Lexer converts source code into tokens.
- The Syntax Analyzer validates program structure.
- The Semantic Analyzer checks variable declarations and type compatibility.
- Analysis results are displayed to the user.
User Code
↓
Lexer
↓
Token Stream
↓
Syntax Analyzer
↓
Semantic Analyzer
↓
Error Report
↓
Web Interface
Static-Code-Analyzer/
│
├── app.py
├── lexer.py
├── parser.py
├── semantic.py
├── templates/
│ └── index.html
├── static/
│
├── README.md
├── requirements.txt
└── .gitignore
git clone https://github.com/Coder-Priyan/Static-Code-Analyzer.git
cd Static-Code-Analyzerpip install flaskpython app.pyhttp://127.0.0.1:5000
int a = 10;
int b = 20;
int sum = a + b;(KEYWORD, int)
(IDENTIFIER, a)
(OPERATOR, =)
(NUMBER, 10)
No Syntax Errors Found
No Semantic Errors Found
- Understanding Compiler Design Fundamentals
- Lexical Analysis
- Syntax Analysis
- Semantic Analysis
- Token Generation
- Symbol Table Management
- Error Detection Techniques
- Flask Web Development
- Support for complete C language syntax
- Abstract Syntax Tree (AST) generation
- Intermediate Code Generation
- Code Optimization Module
- Enhanced Error Reporting
- Multi-language Support
- Priyanshu Dangi
- Akansha Joshi
- Deepak Kumar Kabi
This project is developed for educational and academic purposes.