Skip to content

Akash35721/CP-compiler-version6

Repository files navigation

Akash's CP Compiler

Akash's CP Compiler is a web-based compiler aimed at competitive programming. It combines three core components:

  • Lexical Analysis (Lexer): Converts raw code into tokens.
  • Syntactic Analysis (Parser): Builds an Abstract Syntax Tree (AST) from the tokens.
  • Code Reconstruction (Reconstructor): Traverses the AST to generate optimized C++ code.

Features

  • Tokenizes input code while handling comments and errors.
  • Parses code to validate syntax and detect custom functions.
  • Generates contest-ready, optimized C++ code.
  • Provides a user-friendly web interface built with Flask and Tailwind CSS.

Installation Instructions

  1. Clone the Repository
    Open your terminal and run:

    git clone https://github.com/Akash35721/version5
  2. Navigate to the Project Folder
    Change directory:

    cd version5
  3. Install Python Dependencies
    Run:

    pip install -r requirements.txt
  4. Run the Application
    Start the Flask server:

    python app.py

    Then, open your browser and go to http://127.0.0.1:5000 to use the compiler.

C++ Compilation

The project compiles C++ source files using g++ via a PowerShell script:

  • lexer.cpp
  • parser.cpp
  • reconstructor.cpp

The build_and_run.ps1 script manages the build process.

Project Structure

  • .vscode/ – VS Code settings and configurations.
  • app.py – Flask web server.
  • build_and_run.ps1 – PowerShell build script.
  • lexer.cpp, parser.cpp, reconstructor.cpp – C++ source files.
  • templates/ – HTML template for the web interface.
  • readme.md – Project documentation.

Contributing

Feel free to fork and open pull requests or issues if you find bugs or have suggestions for improvements.

License

This project is shared under the terms defined in the repository.

Happy Coding!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published