A web-based compiler front-end simulation that performs lexical analysis and syntax analysis for balanced delimiters using stack-based parsing, with multi-error detection and visual debugging.
SyntaxStack Analyzer is a mini compiler project designed to demonstrate how real compilers validate code structure.
It focuses on analyzing balanced delimiters like:
( ) { } [ ]
The project simulates:
- Lexical Analysis (Tokenization)
- Syntax Analysis (Parsing)
- Error Detection & Recovery
-
🔍 Lexical Analysis
- Extracts delimiter tokens from input code
-
🧠 Syntax Analysis
- Uses stack-based parsing to validate nesting
-
⚠️ Multi-Error Detection- Detects multiple syntax errors in a single run
-
🎯 Error Highlighting
- Highlights exact error positions in the code
-
📊 Stack Visualization
- Shows step-by-step PUSH and POP operations
-
🎨 Modern UI
- Clean dark interface with animations and hover effects
- Lexical Analysis (Tokenization)
- Syntax Analysis (Parsing)
- Stack Data Structure (LIFO)
- Pushdown Automaton (PDA)
- Context-Free Grammar (CFG)
- Error Detection & Recovery
- User inputs code
- Tokenizer extracts delimiter tokens
- Parser processes tokens using a stack:
- Push → opening brackets
- Pop → closing brackets
- Errors are collected (not stopped at first error)
- Output shows:
- Error messages
- Highlighted positions
- Stack steps
(a + b] { x = (y + z;
- Mismatched
] - Unmatched
( - Unmatched
{
if (a > b) {
x = (y + z);
}
parentheses-checker-compiler/
│
├── index.html
├── css/
│ └── styles.css
├── js/
│ ├── app.js
│ ├── parser.js
│ ├── tokenizer.js
│ └── utils.js
├── assets/
│ └── images/
└── README.md
- Clone the repository
- Open
index.htmlin a browser - Enter code
- Click Analyze Syntax
- Simulates real compiler behavior
- Visualizes stack operations
- Detects multiple syntax errors
- Modular design (Tokenizer + Parser)
- Line & column-based error reporting
- Live syntax checking
- AST (Abstract Syntax Tree) visualization
- Full grammar-based parsing (LL/LR)
Your Name
If you found this project useful, consider giving it a star ⭐ on GitHub.



