Skip to content

Latest commit

ย 

History

27 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ Coding Analyzer & Expression Evaluator

Node.js C++ Express Crow Bootstrap Project DSA Status

A full-stack web application that analyzes code complexity and evaluates mathematical expressions using core data structures.


๐Ÿ“Œ Overview

This project demonstrates the real-world application of Data Structures (Stack) by building:

  • ๐Ÿ”ข Expression Evaluator (Infix, Prefix, Postfix)
  • ๐Ÿ“Š Code Complexity Analyzer (loop depth & estimation)

The system is built using a C++ backend (Crow) and a Node.js server, with a responsive web interface.


๐Ÿง  Core Concepts Used

  • Stack (Expression Evaluation)
  • Parsing & Conversion Algorithms
  • Time Complexity Estimation
  • REST API Design

โš™๏ธ Tech Stack

๐Ÿ”น Backend (Core Logic)

  • C++
  • Crow Framework
  • Custom logic for parsing & evaluation

๐Ÿ”น Server Layer

  • Node.js
  • Express.js
  • Axios

๐Ÿ”น Frontend

  • EJS
  • Bootstrap 5
  • Font Awesome

๐Ÿ—๏ธ Architecture

Browser (UI)
     โ†“
Node.js (Express Server)
     โ†“
C++ API (Crow)
     โ†“
Data Structure Logic (Stack / Analysis)

โœจ Features

๐Ÿ”น Expression Evaluator

  • Supports:

    • Infix
    • Prefix
    • Postfix
  • Converts between formats

  • Evaluates final result

๐Ÿ”น Code Analyzer

  • Counts:

    • for loops
    • if / else
    • while loops
  • Calculates:

    • Maximum nesting depth
    • Estimated time complexity

๐Ÿ”น Error Handling

  • Structured JSON responses

  • Handles:

    • Invalid expressions
    • Empty input
    • Division by zero
    • Invalid code input

๐Ÿ“ฆ API Endpoints

๐Ÿ”น POST /expression

Request:

{
  "expression": "5 6 2 * + 3 -"
}

Response:

{
  "result": 14,
  "prefix": "- + 5 * 6 2 3",
  "infix": "((5 + (6 * 2)) - 3)",
  "postfix": "5 6 2 * + 3 -"
}

๐Ÿ”น POST /analyze

Request:

{
  "code": "for(int i=0;i<n;i++){...}"
}

Response:

{
  "for": 1,
  "if": 0,
  "while": 0,
  "maxDepth": 1,
  "estimatedComplexity": "O(n)"
}

๐Ÿงช Testing

The API has been tested using:

  • Curl
  • Browser integration

Test cases include:

  • Valid expressions
  • Invalid inputs
  • Edge cases (empty input, divide by zero)
  • Nested loops for complexity

๐Ÿš€ Getting Started

๐Ÿ”น 1. Clone the repository

git clone https://github.com/your-username/your-repo.git
cd your-repo

๐Ÿ”น 2. Setup Node.js

npm install

๐Ÿ”น 4. Run C++ Server

g++ main.cpp -o app -lpthread
./app

๐Ÿ”น 5. Run Node Server

node index.js

๐Ÿ”น 6. Open in browser

http://localhost:3000/home

๐Ÿ“ธ Screenshots

๐Ÿ  Homepage

Homepage

๐Ÿงฎ Expression Evaluator

Expression

๐Ÿ“Š Code Analyzer

Analyzer

โš ๏ธ Error Handling

Error


๐Ÿ“ˆ Future Improvements

  • Live evaluation (no page reload)
  • Expression history
  • Step-by-step stack visualization
  • Support for variables

๐Ÿ‘จโ€๐Ÿ’ป Author

Subhranil Mandal


๐Ÿ“„ License

This project is for educational purposes.

Future Improvements / Roadmap

UI & UX Improvements

  • Add hover effects on result cards
  • Add smooth animations and transitions
  • Improve mobile responsiveness
  • Add icons for loops, conditions, complexity, etc.
  • Add loading states while analyzing
  • Add toast notifications for errors/success
  • Add dark/light theme toggle
  • Improve typography and spacing consistency

Visualization Features

Charts & Graphs

  • Add bar chart for loop/condition counts
  • Add pie chart for code structure distribution
  • Add complexity visualization meter
  • Add nesting depth tree visualization
  • Add execution flow visualization
  • Add expression conversion step visualization

Expression Analyzer Improvements

  • Step-by-step infix to postfix conversion
  • Stack visualization during conversion
  • Expression tree generation
  • Expression validation with error highlighting
  • Support variables and functions
  • Support advanced mathematical operators
  • Add expression evaluation support

Code Analyzer Improvements

  • Better time complexity detection
  • Space complexity estimation
  • Detect recursion
  • Detect nested loops more accurately
  • Detect switch/case statements
  • Detect functions/classes
  • Detect unreachable code
  • Detect infinite loops
  • Add cyclomatic complexity analysis
  • Add code smell detection

Advanced Features

  • Syntax highlighting
  • Monaco editor integration
  • File upload support
  • Export analysis report as PDF
  • Save analysis history
  • Authentication system
  • AI-based code suggestions
  • Real-time analysis while typing

Multi-language Support

  • C++
  • Java
  • Python
  • JavaScript

Dashboard Ideas

  • Analysis statistics dashboard
  • Previous analysis history
  • Complexity trend graphs
  • Most used structures analytics
  • User performance analytics

Dev Tool Inspired Features

  • Git visualizer
  • Regex engine visualizer
  • Debugger simulation
  • AST (Abstract Syntax Tree) visualization
  • Compiler pipeline visualization
  • Memory/stack visualization
  • Tokenizer visualization

Performance Improvements

  • Optimize parser speed
  • Improve large code handling
  • Lazy rendering for large outputs
  • Better state management
  • Backend optimization

Long-Term Vision

  • Turn project into a complete developer toolkit
  • Add interactive learning mode
  • Add DSA visualization support
  • Add competitive programming utilities
  • Add collaborative sharing features
  • Add plugin architecture for custom analyzers

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages